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

Accessibility issue with custom Navigation buttons #7528

Open
5 of 6 tasks
nhanvervio opened this issue May 13, 2024 · 3 comments
Open
5 of 6 tasks

Accessibility issue with custom Navigation buttons #7528

nhanvervio opened this issue May 13, 2024 · 3 comments
Assignees
Labels
t0ggles Linked to the t0ggles task

Comments

@nhanvervio
Copy link

Check that this is really a bug

  • I confirm

Reproduction link

https://codesandbox.io/p/sandbox/swiper-navigation-forked-jzzmnl?file=%2Findex.html%3A9%2C7

Bug description

When registering custom navigation buttons using Parameters as Props, the buttons are rendered outside the Shadow DOM created by swiper-container.

This is the correct behavior, except these outside buttons now have the aria-controls attribute pointing to a swiper-wrapper element inside the Shadow DOM. This is marked as a Critical accessibility error by tools like Axe or Lighthouse as the Id cannot be queried from outside the Shadow DOM.

image

I'm not sure what the solution is without tearing down the Shadow DOM altogether.
Proposals like AOM's IDREF are promising, but it hasn't been supported by any browsers just yet. Alternatively, I can use Javascript to get rid of the aria-controls attributes, but this is just bypassing the WCAG spec.

Expected Behavior

No accessibility issues flagged by Accessibility tools.

Actual Behavior

aria-controls on custom navigation buttons are flagged as invalid.

Swiper version

11.1.1

Platform/Target and Browser Versions

MacOS 14.4 Chrome 124.0.6367.119

Validations

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
  • Make sure this is a Swiper issue and not a framework-specific issue

Would you like to open a PR for this bug?

  • I'm willing to open a PR
@Xyrai
Copy link

Xyrai commented May 16, 2024

I am experiencing the same issue as mentioned here.

Our custom button is being used outside of Swiper's Shadow DOM which causes an accessibility issue with the IDREF (ID + Aria-Controls) of the Swiper Wrapper element. Lighthouse also does not seem to like this issue resulting into a subtraction of 5 points within the Accessibility section.

@nolimits4web nolimits4web self-assigned this May 16, 2024
@nolimits4web
Copy link
Owner

t0ggles-create swiper

Copy link

t0ggles bot commented May 17, 2024

Task nolimits4web/SWIPER-135 was created

t0ggles task SWIPER-135

@t0ggles t0ggles bot added the t0ggles Linked to the t0ggles task label May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t0ggles Linked to the t0ggles task
Projects
None yet
Development

No branches or pull requests

3 participants