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 with disabled options doesn't close on ESC #16565

Closed
RandomNonameDude opened this issue Jul 19, 2019 · 1 comment · Fixed by #16572
Closed

Menu with disabled options doesn't close on ESC #16565

RandomNonameDude opened this issue Jul 19, 2019 · 1 comment · Fixed by #16572
Assignees
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@RandomNonameDude
Copy link

RandomNonameDude commented Jul 19, 2019

Reproduction

Use StackBlitz to reproduce your issue: https://stackblitz.com/edit/angular-y1wytp?file=app/menu-icons-example.html

Steps to reproduce:

  1. Create menu with disabled options only
  2. Open it
  3. Try pressing ESC key

Expected Behavior

The menu should close after pressing ESC key, same as it does when it contains at least one non-disabled option

Actual Behavior

The menu does not close after pressing ESC key

Environment

  • Angular: 8.1.2
  • CDK/Material: 8.0.2
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows
@crisbeto crisbeto self-assigned this Jul 19, 2019
@andrewseguin andrewseguin added the P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent label Jul 19, 2019
crisbeto added a commit to crisbeto/material2 that referenced this issue Jul 19, 2019
Currently we depend on `focusFirstItem` to bring focus into the menu, however if all the items are disabled, focus will stay on the trigger and the user won't get feedback that something has happened. Furthermore, the keyboard shortcuts that are implemented in the menu won't work either, because the keyboard event listener is on the menu.

These changes work around the issue by setting focus on the `role="menu"` if none of the items were focusable.

Fixes angular#16565.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jul 19, 2019
Currently we depend on `focusFirstItem` to bring focus into the menu, however if all the items are disabled, focus will stay on the trigger and the user won't get feedback that something has happened. Furthermore, the keyboard shortcuts that are implemented in the menu won't work either, because the keyboard event listener is on the menu.

These changes work around the issue by setting focus on the `role="menu"` if none of the items were focusable.

Fixes angular#16565.
jelbourn pushed a commit that referenced this issue Aug 27, 2019
…16572)

Currently we depend on `focusFirstItem` to bring focus into the menu, however if all the items are disabled, focus will stay on the trigger and the user won't get feedback that something has happened. Furthermore, the keyboard shortcuts that are implemented in the menu won't work either, because the keyboard event listener is on the menu.

These changes work around the issue by setting focus on the `role="menu"` if none of the items were focusable.

Fixes #16565.
mmalerba pushed a commit to mmalerba/components that referenced this issue Aug 27, 2019
…ngular#16572)

Currently we depend on `focusFirstItem` to bring focus into the menu, however if all the items are disabled, focus will stay on the trigger and the user won't get feedback that something has happened. Furthermore, the keyboard shortcuts that are implemented in the menu won't work either, because the keyboard event listener is on the menu.

These changes work around the issue by setting focus on the `role="menu"` if none of the items were focusable.

Fixes angular#16565.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants