-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[Menubar] Adds keyboard behaviors to the menubar, improves accessibility #3320
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
[Menubar] Adds keyboard behaviors to the menubar, improves accessibility #3320
Conversation
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.
- Extract logo to header level for better semantic structure
- Ensure arrow keys only cycle through menu items, excluding the logo
…w on an unopened submenu
Thanks so much for catching this—that explains a lot! It makes so much sense when I interact with the menubar now!!! 😂
Hmm, yeah since disabling the menuitems seems like an established pattern, I'm totally on board with going that route here! I think the conditional rendering was originally used because the component was first built using
Thanks so much for linking the screenshots and confirming that it seems to work! I'm wondering do you think it makes sense to break this out into a separate PR, or is it better to keep it within this one? |
i thought i'd want to break it out, but i think it makes more sense to keep in the current PR since it feels necessary for the component to work. i'll keep the changes small we can open up another PR in the future in case we need to make improvements. |
@raclim these last changes should put the menubar in better condition! all the menuitems are now visible but ones that require certain conditions to be met are disabled. disabled options are still focusable but cannot be activated as described in the menubar pattern and this guide on keyboard interfaces. i had some state updating issues which are hopefully resolved now but will probably need to be monitored. i didn't address the simultaneous mouse hover / key inputs being visible since that doesn't necessarily impact the component on a functional level; it also appears like there aren't any specific wcag guidelines so we can maybe discuss what feels ideal for the editor environment (the menubar example does show both indicators simultaneously though). otherwise would love for you to check this out when you can! there's a little more clean up left to do and then i just want to finish documenting any other changes / improvements that can be made in future PRs. |
Thanks so much for touching this up, I think this is really awesome and feels much smoother to me! I think the only minor tweaks that I'm seeing are styling related, mostly regarding the background when a user hovers over the "Back to Editor" link (pictured below), which I think appears a bit cut off! I'm also wondering this extends to the Upper-right Hand Dropdown menu as well (aslo pictured below), but I think it could also be fine as is! Upper-right Hand Dropdown Menu on Hover Besides this, I feel overall that it's in a pretty good place so far! Thanks so much again for continuing to work on this and bringing some really exciting changes to the navigation!! |
ah yeah that is a bit awkward. i'll add to the list for future tasks -- thanks for spotting it! doing a bit more clean up and i'll ping again when everything feels ready. |
@raclim did another pass to clean up what i could ... also, the initial comment here has been updated with recent changes and possible tasks for the future. there are things i may not have caught, but hopefully they'll surface when the changes roll out and we can address them then. let me know what 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.
Thanks so much for the updates on this!!
I think this overall looks great to me! I think we can probably roll this out if it feels good to you as well!
I'm going to merge this in since we're going to start performing some screen reader testing at the end of this week! Please feel free to follow up on anything here before then! Thanks so much again for all of your patience, time and dedication to revamping the menubar—this is really amazing and I'm really excited to see how folks will engage with it! |
wooo thanks! can't believe it's finally out there. i'll move on to opening up issues for some of the improvements we brought up. excited for the screen reader tests and will keep an eye out on that as well. thanks again! |
Fixes #2933
This PR focuses on adding proper keyboard behaviors to the recently refactored Menubar.
Update
The Menubar component now has keyboard navigation and enhanced accessibility support. There are some other improvements to make which are listed at the end, but we can work on them in future PRs seeing as this one has gotten rather large.
Before:
Navigation happened purely through Tab / Shift + Tab. Escape functionality worked but conventional Menubar behaviors were not accessible. Focus management was not connected to state.
old_menubar_2.mov
After:
Menubar behaviors from the WAI ARIA authoring guide implemented. Tab behavior works as expected and initial focus styles are available.
menubar_after.mov
Key Changes
Menubar.jsx
for focus managementaria-orientation='horizontal'
onMenubar
and aria-labels where applicableMenubar
innav
elementdiv
-based menubar toul/li
Logo
is moved outside of thenav
ul
elements withrole=group
SubmenuContext
for managing submenu stateMenubarSubmenu
supportslistbox
aria roles, such as with the options inLanguageMenu
MobileNav
uses a simplified version of a menuitemTo Do
Menubar
testsmenuItems
andmenuItemToId
could probably be combined into a better data structureuseReducer
MenubarSubmenu
components into separate filesMenubarItem
)I have verified that this pull request:
npm run lint
)npm run test
)develop
branch.Fixes #123