Repository navigation
fix(core): make the TaskBar's Start menu usable from the keyboard - #614
Conversation
Start is now a menu button. It has aria-haspopup and aria-expanded, Enter, Space and ↓ open the menu on its first item, ↑ on its last, and Esc closes it and gives the focus back to Start. Tabbing out of the menu closes it too. The menu now comes after Start in the DOM, so Tab goes from Start into the menu and then on to the window buttons. It still shows in the same place.
|
|
|
Thanks for this, @parthchilwerwar! After #600 the menu worked from the keyboard but you couldn't get into it, and this closes that gap. Moving the menu after Start in the DOM also means Tab finally goes where you'd expect. I tested it in Storybook. Enter, Space and the arrows open the menu on the right item, and Esc puts the focus back on Start. While testing I noticed the TaskBar buttons have |
|
View your CI Pipeline Execution ↗ for commit 85a20cb
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
|
Thanks for testing it and merging, @ggdaltoso! Good catch on the outline. I was so focused on getting into the menu that I missed you can't even see when Start has the focus. I saw #616 already picks up #615 and you're reviewing it, so I'll leave that one to them. |
The Start button opens a List menu, and since #600 that menu can be fully driven from the keyboard, but there was no keyboard way into it. Enter on Start showed the menu while the focus stayed on Start, Esc did nothing, and since the menu came before Start in the DOM, Tab from Start went straight to the window buttons. Screen readers weren't told that Start opens a menu either.
This makes Start a menu button:
aria-haspopup="menu"andaria-expandedon StartpreventDefaultthere, and the top menu leaves Esc to whatever opened itThe menu now renders after Start, so Tab goes from Start into the menu and then on to the window buttons. It's absolutely positioned, so it shows in the same place. I logged its rect in the story test with and without this change and it's identical.
Mouse use doesn't change: a click on Start toggles the menu without moving the focus, and choosing an item closes it.
One thing I left as it is: Shift+Tab from the menu back to Start keeps the menu open. Closing it on that blur would fight with a click on Start (the blur closes it, then the click opens it again). From Start, Enter or Esc closes it.
Testing
aria-haspopup, and after Enter the first item doesn't have the focus) and pass with this change.tscand the unit tests from the git hooks.a11y.testset to'error'locally, the only violation in TaskBar > Simple is the inactive title contrast that chore(storybook): fail story tests on accessibility violations #613 exempts, same as on master.