Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Fix number inputs for IE11 #730

Merged
merged 9 commits into from
Jan 21, 2020
Merged

Fix number inputs for IE11 #730

merged 9 commits into from
Jan 21, 2020

Conversation

shammamah-zz
Copy link
Contributor

Closes #627.

About

The core of the issue was that valueAsNumber was always returning NaN even if the input value was a number, which is a known issue with IE: https://caniuse.com/#feat=input-number

Screen Shot 2020-01-13 at 1 47 37 PM

@@ -89,6 +92,11 @@ export default class Input extends PureComponent {
);
}

getValueAsNumber(value) {
const numericValue = convert(value);
return numericValue % 1 === 0 ? Math.floor(numericValue) : numericValue;
Copy link
Contributor

@Marc-Andre-Rivet Marc-Andre-Rivet Jan 21, 2020

Choose a reason for hiding this comment

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

@shammamah Can you explain the reasoning for this line? If n % 1 === 0 isn't it already an integer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wasn't sure if it would automatically convert to int vs. remaining as a float. Fixed in 24b3b9d.

@@ -93,8 +93,7 @@ export default class Input extends PureComponent {
}

getValueAsNumber(value) {
const numericValue = convert(value);
return numericValue % 1 === 0 ? Math.floor(numericValue) : numericValue;
return convert(value);
Copy link
Contributor

Choose a reason for hiding this comment

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

At this point why not just call convert directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 21281de!

CHANGELOG.md Outdated Show resolved Hide resolved
Shammamah Hossain and others added 2 commits January 21, 2020 13:28
Co-Authored-By: Marc-André Rivet <Marc-Andre-Rivet@users.noreply.github.com>
Copy link
Contributor

@Marc-Andre-Rivet Marc-Andre-Rivet left a comment

Choose a reason for hiding this comment

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

💃

@Marc-Andre-Rivet Marc-Andre-Rivet merged commit e513089 into dev Jan 21, 2020
@Marc-Andre-Rivet Marc-Andre-Rivet deleted the ie11-numeric-input branch January 21, 2020 19:59
JHSaunders pushed a commit to JHSaunders/dash-core-components that referenced this pull request Mar 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Internet Explorer dcc.Input with type='numeric'
2 participants