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: slider screenreader value returning as NaN #6404

Merged
merged 1 commit into from
Jan 15, 2020
Merged
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
4 changes: 2 additions & 2 deletions src/js/slider/slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ class Slider extends Component {
const progress = this.getProgress();

if (progress === this.progress_) {
return;
return progress;
Copy link
Contributor Author

@brandonocasey brandonocasey Jan 14, 2020

Choose a reason for hiding this comment

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

This function has a return value of progress so early returns should return that. This prevents child classes that call this method from setting progress to undefined when progress has not changed.

}

this.progress_ = progress;
Expand All @@ -268,7 +268,7 @@ class Slider extends Component {
* percentage filled that the slider is
*/
getProgress() {
return clamp(this.getPercent(), 0, 1).toFixed(4);
return Number(clamp(this.getPercent(), 0, 1).toFixed(4));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

toFixed turns the number that we get back from clamp into a string so 0 becomes "0.0000" and 0.8777657 becomes "0.8777" when it should be a number still.

}

/**
Expand Down