-
Notifications
You must be signed in to change notification settings - Fork 1.1k
USWDS - Range: Remove redundant ARIA attributes #5413
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds good in JAWS. I can hear "10, 20, 30" etc, and can use the arrow keys to move up and down the range slider. I recommend that whatever the range is indicating be written into the help text. For example "ten percent" instead of just "ten" if the slider is indicating a percentage range.
In NVDA the action is identical to JAWS. I used Chrome to test both.
It looks like we can accomplish the help text that @amycole501 mentions using I'll do a bit more research on this and we can discuss if we want this to be included with this PR, or separated out into it's own issue. My primary concern is if we should maintain |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works well for me in VoiceOver in Safari and VoiceOver Gestures in iOS Safari. I ran into some hiccups with the screen reader performance in Firefox and Chrome, but these issues don’t seem isolated to USWDS (see notes below for more details).
I tested the following:
- Confirmed the issue exists when using VoiceOver in desktop browsers
- Confirmed that the updated component is operable and provides appropriate feedback in VoiceOver. (Values from 0-100 are read out in increments of 10 as you navigate forwards and backwards through the range.)
- In Safari, the component works well with VoiceOver.
- In Firefox I am not able to move backwards in value (ie, moving from 40 to 20) with VoiceOver. However, this issue doesn’t seem isolated to USWDS because I noticed that the same behavior occurs in the “Cowbell” example on MDN in Firefox as well.
- In Chrome, I ran into intermittent issues where it will read the same value twice and read 90 and 10 as the end points, rather than 0 and 100. This is not consistent though and I have been able to get a successful readout in Chrome. This also doesn’t seem isolated to USWDS because I noticed that the same behavior occurs in the “Cowbell” example on MDN as well.
- Both issues in Firefox and Chrome are preferable to the current readout on
develop
. - Interestingly, the issue does not exist in iOS Safari with VoiceOver Gestures and reads out the percentage (”10%”, “20%”, etc). It works well in both
develop
and this PR branch.
Do you get the same results?
The component sounds great in JAWS, NVDA, and Narrator on PC desktop in Chrome and Firefox. The way the volume slider sounds in Narrator on my PC: |
@amyleadem So I was able to replicate the Chrome bug after entering a bunch of inputs to try to trip up VoiceOver. During my testing, I found if you press the left and right arrow keys at the same time it would enable something called "Quick nav". It was only while quick nav was turned on that I would experience this bug! By pressing both of the arrow keys again and disabled quick nav, the bug went away! I was also able to replicate the Firefox bug you mentioned only after enabling quick nav! Could you try testing this again when you have the time? I'm curious if you experience the bugs after toggling quick nav. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mahoneycm good catch! My system did appear to have "quick nav" turned on. When I turned it off, I did not experience the strange behavior in Chrome and Firefox anymore. Nice discovery!
Code looks good. @mahoneycm since this and #5472 have changes to the component. Are there special considerations we need to be aware of when merging? |
Summary
Removed redundant ARIA attributes to improve the screen reader experience. To incorporate these changes, update your range component markup.
Breaking change
Related issue
Closes #5038
Related pull requests
Changelog →
Preview link
Preview link:
Range slider →
Problem statement
Range slider keyboard navigation does not work with VoiceOver. This is caused by redundant aria attributes that are reserved for elements that are more or less "faking" being an
input
withtype="range"
.Example
Slider can only move one increment and does not update read out correctly:
VoiceOver - Video has audio if you unmute
Kapture.2023-08-01.at.14.25.41.mp4
Note: Some more advanced screen readers such as JAWS may intuitively navigate around this issue
Solution
Remove the following attributes:
aria-valuemin
aria-valuemax
aria-valuenow
role="slider"
Sources
MDN Docs: Range slider best practices →
Example
Slider has full range and updates read out correctly
Kapture.2023-08-01.at.14.29.38.mp4
Testing and review
We have discussed potential screen reader callout enhancements which are captured in #5431