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
Chore/update menu accessibility #631
Chore/update menu accessibility #631
Conversation
… menu when Tab is used
…nges to avoid errors for menus that don't have focusable elements
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Awesome thanks @bennymi. It's Saturday for me which is my off day, but I'll give this a proper review tomorrow. Excited to try it out! |
Hey, no worries Chris. Enjoy your day off! |
@bennymi Hey, maybe I'm doing something wrong here, but I can't seem to get this to work. From my understanding when a menu is open I should be able to use the up/down arrows to navigate up/down the list of focusable elements within the menu. Is this correct? Currently we have a couple menus in the documentation that should support this. The "Features" drop down menu at the top of the page, in the App Bar. Plus the Navigation demo on the Menu docs page. Neither behave in this manner when tested though. The page just scrolls slightly up and down. A couple considerations:
For now I'll drop this PR into a draft state. Tap the "ready for review" action on this page when adjustments have been made and this is ready for another review pass. |
… navbar to use focusable buttons
…default behavior when a menu is open to avoid srolling
@endigo9740 thank you for the feedback. I updated the documentation and made sure that up and down arrow keys no longer cause scrolling when a menu is open. But I'm still stuck on one problem. The up and down arrow keys do work when clicking on a menu in both Firefox and Chrome in my testing, but the focused element is only highlighted in Firefox, not in Chrome. This only happens when a click is used to open the menu. When Enter is used to open a menu after it was focused, then the menu items are also highlighted in Chrome. Firefox after clicking on a menu and using the arrow up key: Chrome after clicking on a menu and using the arrow up key: Do you have an idea what could be the reason here? |
@bennymi Interesting, so I'll need to review our focus styling for these soon. That's odd because tab focus workings fine in Chrome. Ok I'm going to mark this ready for review and do another pass with this info. Thanks for updating the keyboard interactions as well! |
@endigo9740 yes it's strange behavior, because when I tab to a menu button and hit enter and the arrow up key I do get focus styling in Chrome as well: It just doesn't work when the menu is clicked and then the arrows are used. |
@endigo9740 if I add Maybe we can adjust the focus styling for elements to have it work on Chrome as well. |
@bennymi I've added some focus styles for anchors limited to within the menu for now. This should work cross browser. We may need to expand the scope over time, but this was working for our AppBar dropdown menu. With that I'm good to merge this! Thanks for your contribution and working with me on this! |
Before submitting the PR:
npm run test
?branch -m new-branch-name
What does your PR address?
Improves menu accessibility by including up and down arrow key functionality and being able to open and close the menu by clicking the menu button. This Resolves #616.
When the menu is opened, using the arrow down key starts at the top and allows the user the move to the next menu items downwards.
When the menu is opened with a click and the arrow up key is used, the last menu item gets focused first.
Tips