Skip to content

fix(material/slider): some screen readers announcing long decimal values #20870

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

Merged

Conversation

crisbeto
Copy link
Member

Note: this is a resubmit of #20721 which renames the aria-valuetext input to valueText based on the note in #20849.

It looks like some screen readers announce the value of a slider by calculating the percentage themselves using the aria-valuemin, aria-valuemax and aria-valuenow. The problem is that they don't round down the decimals so for a slider between 0 and 1
with a step of 0.1, they end up reading out values like 0.20000068. These changes work around the issue by setting aria-valuetext to the same value that we shown in the thumb which we truncate ourselves.

Fixes #20719.

@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent Accessibility This issue is related to accessibility (a11y) merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: patch This PR is targeted for the next patch release labels Oct 23, 2020
@crisbeto crisbeto requested a review from mmalerba as a code owner October 23, 2020 15:19
@google-cla google-cla bot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Oct 23, 2020
@crisbeto
Copy link
Member Author

Caretaker note: these changes have been reverted twice before, because there's an app whose aria-valuetext we'd override. The app would have to be switched over to the new valueText input on mat-slider.

It looks like some screen readers announce the value of a slider by calculating the
percentage themselves using the `aria-valuemin`, `aria-valuemax` and `aria-valuenow`.
The problem is that they don't round down the decimals so for a slider between 0 and 1
with a step of 0.1, they end up reading out values like 0.20000068. These changes work
around the issue by setting `aria-valuetext` to the same value that we shown in the thumb
which we truncate ourselves.

Fixes angular#20719.
@crisbeto crisbeto force-pushed the slider-value-text-3-revenge-of-the-sith branch from cd18d8f to 97b90d7 Compare October 26, 2020 17:15
@crisbeto
Copy link
Member Author

Reworked based on the feedback and added another test case.

Copy link
Contributor

@mmalerba mmalerba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mmalerba mmalerba added the action: merge The PR is ready for merge by the caretaker label Oct 27, 2020
Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@annieyw annieyw merged commit 9f4415e into angular:master Nov 4, 2020
annieyw pushed a commit that referenced this pull request Nov 4, 2020
…ues (#20870)

It looks like some screen readers announce the value of a slider by calculating the
percentage themselves using the `aria-valuemin`, `aria-valuemax` and `aria-valuenow`.
The problem is that they don't round down the decimals so for a slider between 0 and 1
with a step of 0.1, they end up reading out values like 0.20000068. These changes work
around the issue by setting `aria-valuetext` to the same value that we shown in the thumb
which we truncate ourselves.

Fixes #20719.

(cherry picked from commit 9f4415e)
annieyw pushed a commit that referenced this pull request Nov 4, 2020
…ues (#20870)

It looks like some screen readers announce the value of a slider by calculating the
percentage themselves using the `aria-valuemin`, `aria-valuemax` and `aria-valuenow`.
The problem is that they don't round down the decimals so for a slider between 0 and 1
with a step of 0.1, they end up reading out values like 0.20000068. These changes work
around the issue by setting `aria-valuetext` to the same value that we shown in the thumb
which we truncate ourselves.

Fixes #20719.

(cherry picked from commit 9f4415e)
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Accessibility This issue is related to accessibility (a11y) action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(Slider): Jaws and NVDA incorrectly announcing decimal numbers
4 participants