Skip to content

Accessibility Issue on Layer Component: Focus Retained on Element with aria-hidden #7459

@jfeferman

Description

@jfeferman

Is this something you or your team is interested in contributing a pull request towards?

Yes

Expected Behavior

Layer component with modal set to true should conform to accessibility guidelines.

Actual Behavior

The following console error is displayed when opening the modal:

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: a
Ancestor with aria-hidden:  <a tabindex=​"-1" aria-hidden=​"true" class=​"LayerContainer__HiddenAnchor-sc-1srj14c-0 kwDYmk">​</a>​

It seems an ancestor of the hidden layer anchor is also set with aria-hidden=​"true", causing the error.

URL, screen shot, or Codepen exhibiting the issue

Screenshot 2024-12-09 at 23 45 30

Steps to Reproduce

  1. go to https://v2.grommet.io/layer
  2. Open dev tools console
  3. click the "Show" button.

Your Environment

  • Grommet version: 2 - whatever's on the component playground at https://v2.grommet.io/layer
  • Browser Name and version: Chrome Version 131.0.6778.109
  • Operating System and version (desktop or mobile): Mac OS 14.7.1 desktop

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions