Sitelet https://web.archive.org/web/20220518233916/https://github.com/angular/components/pull/20760
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

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

Merged
merged 1 commit into from Oct 20, 2020

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Oct 9, 2020

Note: this is a resubmit of #20721 which had to be reverted because it was overriding people's aria-valuetext. This PR includes an input that allows for it to be changed.

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.

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 added P3 caretaker note target: patch labels Oct 9, 2020
@crisbeto crisbeto requested a review from mmalerba as a code owner Oct 9, 2020
@google-cla google-cla bot added the cla: yes label Oct 9, 2020
@crisbeto
Copy link
Member Author

@crisbeto crisbeto commented Oct 9, 2020

Caretaker note: this PR includes an input to allow people to override the aria-valuetext, but some apps that bind it using [attr.aria-valuetext] might still fail. The apps would have to be changed to use <mat-slider [aria-valuetext]="..."> instead.

@wagnermaciel wagnermaciel self-requested a review Oct 9, 2020
Copy link
Contributor

@wagnermaciel wagnermaciel left a comment

LGTM

@wagnermaciel wagnermaciel added the merge ready label Oct 9, 2020
@jelbourn jelbourn merged commit 19f5f5c into angular:master Oct 20, 2020
16 checks passed
jelbourn pushed a commit that referenced this issue Oct 20, 2020
…ues (#20760)

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 19f5f5c)
jelbourn added a commit to jelbourn/components that referenced this issue Oct 21, 2020
…imal values (angular#20760)"

This reverts commit 19f5f5c.

Reverting this for two reasons:
* the truthiness check is a bit too broad, preventing someone
  from setting the empty string or zero
* I'd prefer to have the input named `valuetext` rather than `aria-valuetext`
  since it's potentially confusing without supporting the `attr.`
  (I know we do this elsewhere, but I'd like to avoid more use of
  this pattern)
jelbourn added a commit that referenced this issue Oct 22, 2020
…imal values (#20760)" (#20849)

This reverts commit 19f5f5c.

Reverting this for two reasons:
* the truthiness check is a bit too broad, preventing someone
  from setting the empty string or zero
* I'd prefer to have the input named `valuetext` rather than `aria-valuetext`
  since it's potentially confusing without supporting the `attr.`
  (I know we do this elsewhere, but I'd like to avoid more use of
  this pattern)
jelbourn added a commit that referenced this issue Oct 22, 2020
…imal values (#20760)" (#20849)

This reverts commit 19f5f5c.

Reverting this for two reasons:
* the truthiness check is a bit too broad, preventing someone
  from setting the empty string or zero
* I'd prefer to have the input named `valuetext` rather than `aria-valuetext`
  since it's potentially confusing without supporting the `attr.`
  (I know we do this elsewhere, but I'd like to avoid more use of
  this pattern)

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

@angular-automatic-lock-bot angular-automatic-lock-bot bot commented Nov 20, 2020

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 Nov 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
caretaker note cla: yes merge ready P3 target: patch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants