Skip to content
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

Menu: support up/down arrow keys on menu triggers #21004

Open
ramji-seetharaman opened this issue Nov 10, 2020 · 9 comments
Open

Menu: support up/down arrow keys on menu triggers #21004

ramji-seetharaman opened this issue Nov 10, 2020 · 9 comments
Labels
Accessibility This issue is related to accessibility (a11y) area: material/menu feature This issue represents a new feature or feature request rather than a bug or bug fix needs: discussion Further discussion with the team is needed before proceeding P4 A relatively minor issue that is not relevant to core functions

Comments

@ramji-seetharaman
Copy link

Reproduction

https://stackblitz.com/angular/kdxrpaxealr?file=src%2Fapp%2Fmenu-overview-example.ts

Steps to reproduce:

  1. Navigate to the StackBlitz link provided above
  2. Tab to the Menu component
  3. Verify whether keyboard interactions for Menu works as per ARIA specifications.

Expected Behavior

Keyboard interactions for Menu needs to work as per ARIA specifications. Here is the keyboard support for Accessible Menus as per the ARIA specifications.

The menus are keyboard accessible:

Activate the triggering element using the keyboard.
Press the UP and DOWN Arrow keys to move focus between the menu options.
Press the LEFT and RIGHT Arrow keys to open or close submenus.
Press ENTER to activate a menu option.
Press ESCAPE to close the currently open menu.
Press TAB or set focus back on the triggering element to close the menu and all submenus.
Mouse users can click the desired menu option as usual.

Out of this, there are a couple of keyboard behaviors that doesn't work as expected. When the focus moves to the button that triggers the menu, even though the enter key activates and opens the menu, activating the Up/Down arrow keys must open the menu and move focus to the last and the first menuitem respectively. Also when the user activates the "Tab" keystroke from inside the menu, focus needs to return back to the triggering element that opened the menu.

Actual Behavior

Currently activating the "Tab" keystroke moves focus to the next interactive element in the page. Focus needs to move back to the menu button that triggered it.

When focus moves to the menu and the user uses Up/Down arrow keys, there is no action that is triggered to open the menu.

Reference Links:

  1. http://whatsock.com/tsg/
  2. https://www.w3.org/WAI/tutorials/menus/application-menus/

Environment

  • Angular: 10.2.7
  • CDK/Material: 10.2.7
  • Browser(s): all
  • Operating System (e.g. Windows, macOS, Ubuntu): all

Menu - Keyboard Issue

@ramji-seetharaman ramji-seetharaman added the needs triage This issue needs to be triaged by the team label Nov 10, 2020
@ramji-seetharaman ramji-seetharaman changed the title bug(Menu): [Accessibility] - Keyboard Support and interactions for the menu is not correct for Menu bug(Menu): [Accessibility] - Keyboard Support and interactions for the menu is not correct Nov 10, 2020
@ramji-seetharaman ramji-seetharaman changed the title bug(Menu): [Accessibility] - Keyboard Support and interactions for the menu is not correct bug(Menu): [Accessibility] - Keyboard Support and interactions for the menu is not fully supported Nov 10, 2020
@jelbourn jelbourn added Accessibility This issue is related to accessibility (a11y) area: material/menu needs: discussion Further discussion with the team is needed before proceeding P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent and removed needs triage This issue needs to be triaged by the team labels Nov 12, 2020
@ramji-seetharaman
Copy link
Author

@jelbourn - Hi Jeremy. Do you need anything in specific that needs to be discussed?

@jelbourn
Copy link
Member

The W3C authoring practices list the up/down arrow key behavior on the trigger as optional. Since this is optional, I don't necessarily see us adding this behavior.

The authoring practices for menu state that tab/shift+tab should move the focus to the next/previous element, respectively, so I believe the current behavior is working as expected.

@jelbourn jelbourn changed the title bug(Menu): [Accessibility] - Keyboard Support and interactions for the menu is not fully supported Menu: support up/down arrow keys on menu triggers Nov 25, 2020
@jelbourn jelbourn added feature This issue represents a new feature or feature request rather than a bug or bug fix P4 A relatively minor issue that is not relevant to core functions and removed P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent labels Nov 25, 2020
@ramjiseetharaman
Copy link

@jelbourn - Thank you so much Jeremy for providing references to W3C Authoring practices. I do agree with you that the Down/Up Arrow navigation is marked optional is the Authoring practices. But I did look into multiple examples with Menus and a standard menu usually supports the Up/Down arrow since menus in general are seen similar to application menus(Docs, Sheets etc) and the interactions that are expected are the same.

The first 5 examples from an ARIA menu google search yielded me results where they primarily support Up/Down interactions rather than activating it user enter. The keyboard support documents the Up/Down arrow. I agree it is optional, but at least can be a good additional behavior.

https://w3c.github.io/aria-practices/examples/menu-button/menu-button-actions.html
https://www.w3.org/WAI/GL/wiki/Using_ARIA_menus
https://www.w3.org/TR/wai-aria-practices/examples/menu-button/menu-button-links.html
http://whatsock.com/tsg/
https://www.levelaccess.com/challenges-mega-menus-standard-menus-make-accessible/

But, I agree with you that it is optional and also to the fact that Tab/Shift + Tab moves focus to the next/previous interactive element. This behavior is working as expected. Sorry for the misinformation.

@ramjiseetharaman
Copy link

ramjiseetharaman commented Dec 21, 2020

@jelbourn - Will this be worked as a feature request anytime soon Jeremy? We are using this component in our application and dependent on the issue to get fixed! Kindly requesting you to provide an update

@jelbourn
Copy link
Member

jelbourn commented Jan 5, 2021

Since the issue is optional, it's a low priority for us and we probably won't work on it any time soon.

@ramji-seetharaman
Copy link
Author

@jelbourn - Just circling back with you to check whether this feature will be added in the near future?

@jelbourn
Copy link
Member

We don't have plans to work on this, but it should be pretty straightforward to add custom key handling to support this at the application level.

@angular-robot
Copy link
Contributor

angular-robot bot commented Feb 25, 2022

Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.

Find more details about Angular's feature request process in our documentation.

@angular-robot
Copy link
Contributor

angular-robot bot commented Mar 16, 2022

Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.

We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.

You can find more details about the feature request process in our documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accessibility This issue is related to accessibility (a11y) area: material/menu feature This issue represents a new feature or feature request rather than a bug or bug fix needs: discussion Further discussion with the team is needed before proceeding P4 A relatively minor issue that is not relevant to core functions
Projects
None yet
Development

No branches or pull requests

4 participants