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

Focus drops to body if a menu item is removed while focused #14028

Closed
diminutivesloop opened this issue Nov 7, 2018 · 5 comments · Fixed by #14039
Closed

Focus drops to body if a menu item is removed while focused #14028

diminutivesloop opened this issue Nov 7, 2018 · 5 comments · Fixed by #14039
Assignees
Labels
Accessibility This issue is related to accessibility (a11y) area: material/menu P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@diminutivesloop
Copy link

Bug, feature request, or proposal:

Bug

What is the expected behavior?

It should be possible to use the MatMenuTrigger.menuOpened event to load new menu data when a menu is opened.

What is the current behavior?

If menu data changes after Mat-Menu is opened the menu loses focus and the user can't navigate the menu with arrow keys unless they tab back to the menu.

What are the steps to reproduce?

https://stackblitz.com/edit/mat-menu-on-open-update-issue

What is the use-case or motivation for changing an existing behavior?

Sometimes it is desirable to load menu data only when the user clicks the menu to avoid unnecessary network requests. Doing this should not break accessibility.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Material: 7.0.3
Angular: 7.0.3

@crisbeto crisbeto self-assigned this Nov 8, 2018
@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent Accessibility This issue is related to accessibility (a11y) has pr labels Nov 8, 2018
crisbeto added a commit to crisbeto/material2 that referenced this issue Nov 8, 2018
Fixes the user's focus being lost if the active item is destroyed while a menu is open.

Fixes angular#14028.
crisbeto added a commit to crisbeto/material2 that referenced this issue Nov 8, 2018
Fixes the user's focus being lost if the active item is destroyed while a menu is open.

Fixes angular#14028.
crisbeto added a commit to crisbeto/material2 that referenced this issue Nov 27, 2018
Fixes the user's focus being lost if the active item is destroyed while a menu is open.

Fixes angular#14028.
crisbeto added a commit to crisbeto/material2 that referenced this issue Dec 5, 2018
Fixes the user's focus being lost if the active item is destroyed while a menu is open.

Fixes angular#14028.
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 27, 2019
Fixes the user's focus being lost if the active item is destroyed while a menu is open.

Fixes angular#14028.
@tketron
Copy link

tketron commented Feb 27, 2019

Any ideas when this fix will be merged in? Or a workaround to use in the meantime?

@kasperlauge
Copy link

Still experiencing this issue, has it been resolved?

crisbeto added a commit to crisbeto/material2 that referenced this issue Jun 2, 2019
Fixes the user's focus being lost if the active item is destroyed while a menu is open.

Fixes angular#14028.
crisbeto added a commit to crisbeto/material2 that referenced this issue Oct 5, 2019
Fixes the user's focus being lost if the active item is destroyed while a menu is open.

Fixes angular#14028.
crisbeto added a commit to crisbeto/material2 that referenced this issue Mar 20, 2020
Fixes the user's focus being lost if the active item is destroyed while a menu is open.

Fixes angular#14028.
@MaksymKurylko
Copy link

Looks like there is no fix here up to now.

@jelbourn
Copy link
Member

@crisbeto this should be fixed as of v9 when we switched menu to use @ContentChildren, right?

@jelbourn jelbourn changed the title Lazy loaded menu content breaks keyboard accessibility Focus drops to body if a menu item is removed while focused Nov 25, 2020
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 26, 2022
Fixes the user's focus being lost if the active item is destroyed while a menu is open.

Fixes angular#14028.
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 27, 2022
Fixes the user's focus being lost if the active item is destroyed while a menu is open.

Fixes angular#14028.
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 27, 2022
Fixes the user's focus being lost if the active item is destroyed while a menu is open.

Fixes angular#14028.
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 27, 2022
Fixes the user's focus being lost if the active item is destroyed while a menu is open.

Fixes angular#14028.
crisbeto added a commit that referenced this issue Feb 27, 2022
Fixes the user's focus being lost if the active item is destroyed while a menu is open.

Fixes #14028.
crisbeto added a commit that referenced this issue Feb 27, 2022
Fixes the user's focus being lost if the active item is destroyed while a menu is open.

Fixes #14028.

(cherry picked from commit dc4fbcf)
@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 Mar 30, 2022
forsti0506 pushed a commit to forsti0506/components that referenced this issue Apr 3, 2022
Fixes the user's focus being lost if the active item is destroyed while a menu is open.

Fixes angular#14028.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Accessibility This issue is related to accessibility (a11y) area: material/menu 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.

7 participants