Skip to content

Revert "fix(material/slider): some screen readers announcing long dec… #20753

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
merged 1 commit into from
Oct 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions src/material/slider/slider.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -507,16 +507,6 @@ describe('MatSlider', () => {
expect(sliderInstance.value).toBe(0.3);
});

it('should set the truncated value to the aria-valuetext', () => {
fixture.componentInstance.step = 0.1;
fixture.detectChanges();

dispatchSlideEventSequence(sliderNativeElement, 0, 0.333333);
fixture.detectChanges();

expect(sliderNativeElement.getAttribute('aria-valuetext')).toBe('33');
});

});

describe('slider with auto ticks', () => {
Expand Down
7 changes: 0 additions & 7 deletions src/material/slider/slider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,6 @@ const _MatSliderMixinBase:
'[attr.aria-valuemax]': 'max',
'[attr.aria-valuemin]': 'min',
'[attr.aria-valuenow]': 'value',

// NVDA and Jaws appear to announce the `aria-valuenow` by calculating its percentage based
// on its value between `aria-valuemin` and `aria-valuemax`. Due to how decimals are handled,
// it can cause the slider to read out a very long value like 0.20000068 if the current value
// is 0.2 with a min of 0 and max of 1. We work around the issue by setting `aria-valuetext`
// to the same value that we set on the slider's thumb which will be truncated.
'[attr.aria-valuetext]': 'displayValue',
'[attr.aria-orientation]': 'vertical ? "vertical" : "horizontal"',
'[class.mat-slider-disabled]': 'disabled',
'[class.mat-slider-has-ticks]': 'tickInterval',
Expand Down