Skip to content

Accessibility conflict: Swiper adds redundant aria-disabled attribute alongside disabled attribute on navigation buttons #7975

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

Open
5 of 6 tasks
Svashly opened this issue Apr 25, 2025 · 0 comments

Comments

@Svashly
Copy link

Svashly commented Apr 25, 2025

Check that this is really a bug

  • I confirm

Reproduction link

https://codesandbox.io/p/devbox/great-firefly-qsrvzj

Bug description

When using Swiper's navigation buttons, we've discovered an accessibility issue that affects screen readers. Swiper adds both disabled and aria-disabled attributes to navigation buttons when they are disabled (at the beginning/end of the carousel).
This redundancy creates confusion for screen readers, as they already recognize the native disabled attribute. The presence of both attributes can lead to incorrect announcements or double announcements, creating a poor experience for users with disabilities.

Image

Expected Behavior

When a Swiper carousel navigation button is disabled (for example, the previous button at the first slide or the next button at the last slide), it should only have the native HTML disabled attribute applied. The redundant aria-disabled attribute should not be present, as it creates confusion for screen readers and can lead to duplicate or incorrect announcements.
Screen readers already correctly interpret the standard disabled attribute on buttons, so adding aria-disabled="true" alongside it is unnecessary and creates accessibility issues. Similarly, enabled buttons should not have aria-disabled="false" attributes, as this is also redundant.

Actual Behavior

Currently, Swiper adds both a native HTML disabled attribute and a redundant aria-disabled="true" attribute to navigation buttons when they are disabled (the previous button at the first slide or the next button at the last slide). Similarly, enabled buttons unnecessarily receive an aria-disabled="false" attribute.
This redundancy creates confusion for screen readers, as they already correctly interpret the standard disabled attribute. The presence of both attributes can lead to duplicate or incorrect announcements, creating a poor experience for users with disabilities.
When inspecting the DOM, we can see this redundant pattern:
Disabled buttons have both disabled and aria-disabled="true" attributes
Enabled buttons have an unnecessary aria-disabled="false" attribute
This implementation violates accessibility best practices and negatively impacts the user experience for those using assistive technologies.

Swiper version

11.x

Platform/Target and Browser Versions

Windows 11

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
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