You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
Check that this is really a bug
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.
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
Would you like to open a PR for this bug?
The text was updated successfully, but these errors were encountered: