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

Carousel: aria-hidden Conflict with Indicator Focus #7414

Closed
1 of 2 tasks
denizguzel opened this issue Jan 26, 2025 · 1 comment
Closed
1 of 2 tasks

Carousel: aria-hidden Conflict with Indicator Focus #7414

denizguzel opened this issue Jan 26, 2025 · 1 comment
Labels
Fixed Completed issues that will be published with next patch (1.0.X)

Comments

@denizguzel
Copy link
Contributor

denizguzel commented Jan 26, 2025

Dependencies check up

  • I have verified that I use latest version of all @mantine/* packages

What version of @mantine/* packages do you have in package.json?

7.16.1

What package has an issue?

@mantine/carousel

What framework do you use?

Vite

In which browsers you can reproduce the issue?

Chrome

Describe the bug

When the Carousel component is used with withIndicators, clicking on any of the indicators produces the following error 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](https://www.google.com/url?sa=E&q=https%3A%2F%2Fw3c.github.io%2Faria%2F%23aria-hidden).
Element with focus: button
Ancestor with aria-hidden: <button class="mantine-focus-auto m_eae68602 mantine-Carousel-indicator m_87cf2631 mantine-UnstyledButton-root" type="button" aria-hidden="true" tabindex="-1" data-orientation="horizontal"></button>

This error message indicates that an indicator button within the Carousel, which has the aria-hidden="true" attribute, is somehow receiving focus. This is a violation of accessibility guidelines because assistive technologies rely on focus to convey information to users. The browser is blocking the hiding of this element because it or one of its descendants currently has focus. The recommended solution is to use the inert attribute instead of aria-hidden, as inert both visually hides and prevents interaction with the element, including focusing.

You can reproduce the issue on the Mantine documentation website: https://mantine.dev/x/carousel/#options. Try clicking on one of the indicator buttons below the carousel to see the error in your browser's console.

Image

If possible, include a link to a codesandbox with a minimal reproduction

No response

Possible fix

No response

Self-service

  • I would be willing to implement a fix for this issue
rtivital added a commit that referenced this issue Feb 8, 2025
@rtivital rtivital added the Fixed Completed issues that will be published with next patch (1.0.X) label Feb 8, 2025
@rtivital
Copy link
Member

rtivital commented Feb 8, 2025

Fixed in 7.16.3

@rtivital rtivital closed this as completed Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed Completed issues that will be published with next patch (1.0.X)
Projects
None yet
Development

No branches or pull requests

2 participants