Any specific strategies for handling a button within a button, for VO + Voice/Switch Control?

For example, we have a "card view" that navigates to a comprehensive detail screen... But there's an ellipsis on the card as well, that shows a menu of quick actions. We need both to be tappable.

(SwiftUI project)

Answered by Engineer in 891306022

So depending on your layout I have a couple of ideas.

Buttons within buttons should already be accessible, through custom actions. The user can use the VoiceOver rotor to select the action that the ellipsis performs. This is generally preferable if you have a list of cards, all with ellipsis buttons in them. This allows the user to quickly navigate between cards without having to land on every ellipsis button.

However if it's just one card, you could also use .accessibilityRepresentation to represent these accessibility elements as two sibling buttons. https://developer.apple.com/documentation/swiftui/view/accessibilityrepresentation(representation:)

You could use accessibilityRep to replace the card view with a button with two elements one for the card and one for the button with non overlapping frames so exploring by touch works well

So depending on your layout I have a couple of ideas.

Buttons within buttons should already be accessible, through custom actions. The user can use the VoiceOver rotor to select the action that the ellipsis performs. This is generally preferable if you have a list of cards, all with ellipsis buttons in them. This allows the user to quickly navigate between cards without having to land on every ellipsis button.

However if it's just one card, you could also use .accessibilityRepresentation to represent these accessibility elements as two sibling buttons. https://developer.apple.com/documentation/swiftui/view/accessibilityrepresentation(representation:)

Any specific strategies for handling a button within a button, for VO + Voice/Switch Control?
 
 
Q