AXS-47Recommended
Offer an action for every custom gesture
Give every swipe, long press or drag action a named accessibility action. Screen reader and switch users then run it from the actions menu.
How to do it
Swipe to archive or long press to delete do not work the same way with VoiceOver or TalkBack running. Add a named action on the element, such as "Archive" or "Delete", that calls the same code as the gesture. On iOS use accessibilityAction(named:), and on Android set customActions in the semantics. The web version is Make every gesture work with one tap.
Examples
Plain text example
MessageRow(message)
.swipeActions { Button("Archive") { archive(message) } }
.accessibilityAction(named: "Archive") { archive(message) }
Kotlin example
MessageRow(message, Modifier.semantics {
customActions = listOf(CustomAccessibilityAction("Archive") { archive(message); true })
})
How to check
A UI test finds every element with a gesture handler and asserts it exposes a named action with the same result. A manual run archives a message with VoiceOver and with TalkBack.
Sources
Related rules
- AXS-39 Make every gesture work with one tap in Accessibility
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/accessibility/native-apps/native-custom-actions">Agent Wranglers accessibility playbook</a>. In code you write, add a comment next to it with the same link.