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

md-menu: Blocked aria-hidden on an element because its descendant retained focus. #5760

Open
austinw-fineart opened this issue Dec 23, 2024 · 0 comments

Comments

@austinw-fineart
Copy link

austinw-fineart commented Dec 23, 2024

What is affected?

Accessibility, Component

Description

When defocusing a menu in a specific way, the following error appears in the console:

Blocked aria-hidden on an element because its descendant retained focus. The focus must not be hidden from assistive technology users. Avoid using aria-hidden on a focused element or its ancestor. Consider using the inert attribute instead, which will also prevent focus. For more details, see the aria-hidden section of the WAI-ARIA specification at https://w3c.github.io/aria/#aria-hidden.
Element with focus: li
Ancestor with aria-hidden: <md-menu id=​"usage-menu" anchor=​"usage-anchor" aria-hidden=​"true">​…​​

This error will only appear when the following conditions are met:

  1. The menu must be fully open (the menu will not auto-close otherwise)
  2. The new focus must be something outside of the current browser page (another tab, window, app, etc.)
  3. The error will only appear once per menu

Reproduction

https://material-web.dev/components/menu/

Workaround

I have not found a workaround

Is this a regression?

No or unsure. This never worked, or I haven't tried before.

Affected versions

2.2.0

Browser/OS/Node environment

Browser: Chrome 131.0.6778.205
OS: Windows 11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant