-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(Menu): improve accessibility around dismissing #2028
Conversation
Hey @brunohkbx, thank you for your pull request 🤗. The documentation from this branch can be viewed here. |
The mobile version of example app from this branch is ready! You can see it here |
src/components/Menu/Menu.tsx
Outdated
<TouchableWithoutFeedback onPress={onDismiss}> | ||
<TouchableWithoutFeedback | ||
onPress={onDismiss} | ||
testID={overlayTestID} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I preferred the one passing testID
to the actual view with content, instead of an overlay. Can we bring that back and get rid of overlayTestID
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a need to pass testID
to the menu content? It should already be possible to pass them to menu items which the user interacts with.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible to pass to menu items. However, there's no way to trigger dismiss on them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand what you mean by triggering dismiss on menu items
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brunohkbx after talking with @thymikee, maybe instead of overlayTestID
, it'd be better to expose a prop overlayAccessibilityLabel
which defaults to "Close menu" that you can use to press on it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've concluded that non-visual users don't have an easy way to dismiss the menu at the moment, so the right thing to do would be empowering them to do so. We think that's the best way forward and it would be lovely if you could make it happen as a part of this PR (rewording it a bit).
Once we're done, we leave the library more accessible and testable, which is a win-win!
Please note that this will be slightly harder to develop, because it involves testing with VoiceOver and TalkBack. Hope you're not mad at us :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds great! will do.
Thanks for your efforts on this 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In terms of accessibility, I can suggest:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's done. Menu already has a BackHandler listener, so we are good.
eae20b2
to
3ac6c34
Compare
3ac6c34
to
86ea6ad
Compare
954194d
to
e1a2af5
Compare
849e95e
to
0f1f50d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, feel free to consult the best prop naming with @satya164 and @Trancever :)
0f1f50d
to
7537fab
Compare
src/components/Menu/Menu.tsx
Outdated
/** | ||
* Accessibility label for the overlay. This is read by the screen reader when the user taps outside the menu. | ||
*/ | ||
dismissAccessibilityLabel?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think overlayAccessibilityLabel
makes more sense. @satya164 What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @brunohkbx. Thanks!
following up #2010
Test plan
Android
accessibilityLabel
of the overlay with TalkBackiOS
onAccessibilityEscape
dismiss the menu with the escape/scrub gesture