Problem/Motivation
In #3436130: Ensure keyboard navigation works with the drawer, the Submenu spec says for Escape:
• Closes submenu.
For me in the "desktop" version, when a submenu is opened by hover and a second menubar (aka, "parent") item has focus, Escape does not close the submenu.
WCAG success criteria
- 2.1.1: Keyboard (Level A)
- Possibly also a violation of the Dismissible criterion of SC 1.4.13 Content on Hover or Focus:
A mechanism is available to dismiss the additional content without moving pointer hover or keyboard focus, unless the additional content communicates an input error or does not obscure or replace other content
Steps to reproduce
- Enable the Navigation module.
- Log in as admin.
- Tab to an item in the Navigation menu bar that has a submenu.
- With the focus still on the item above, hover the cursor over a second parent menu item so that the submenu of this second item opens.
- Press
Escape.
Expected
Pressing Escape closes the submenu that is opened by hover.
Actual
Pressing Escape does not close the submenu that is opened by hover.
In the attached video, both the Shortcuts submenu and the Content submenu are opened by hover.
Escape did close the Shortcuts submenu as expected. However, I am pressing Escape while the Content submenu is open, and it's not closing.
Proposed resolution
- Close the submenu on hover.
- Update tests to confirm that it works correctly.
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Comments
Comment #2
kentr commentedAdding proposed resolution.
Comment #3
kentr commentedComment #4
catchComment #5
kentr commentedThere's a related issue noted by @rkoller originally (#61): #3436130-61: Ensure keyboard navigation works with the drawer.
I think this logic will fix both:
When opening any menu / submenu, close all other other menus / submenus at that same depth.
Comment #6
kentr commentedAlso related:
The first might be in scope here, as they are both related to the conditions for closing a given menu / submenu.
The second might give clues on how to fix.
Comment #7
kentr commentedAlso, #5 here might be moot if the complex arrow key functions for the menubar pattern are removed in favor of the disclosure pattern: #3541688-5: Focus does not move to submenu when opened by enter or space key.
Comment #8
kentr commentedJust read the disclosure pattern again and was reminded that arrow key support is optional.
Comment #10
mgiffordIn discussion with @mherchel @rkoller & @kat-shaw we decided that this was not a barrier. So not a stable profile blocker, but we should get this fixed.
Comment #11
kentr commentedThis is still relevant in the collapsed version of the "desktop" sidebar. "Collapsed version" means the version with only icons.
Can't repro on the expanded "desktop" version at the moment because the entire sidebar collapses when
ESCis pressed.I'm not sure if that's the desired behavior, so might be a different bug. Might have been caused by #3572628: Mobile sidebar should close by ESCAPE key.