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

Conversation

brandonocasey
Copy link
Contributor

Description

Without these changes area-valuenow for the seek bar often reports NaN

@@ -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.

@@ -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.

@gkatsev
Copy link
Member

gkatsev commented Jan 15, 2020

This likely fixes #5984. Wonder if @misteroneill remembers any specific cases we should look out for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants