Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Fix number inputs for IE11#730

Merged
Marc-Andre-Rivet merged 9 commits intodevfrom
ie11-numeric-input
Jan 21, 2020
Merged

Fix number inputs for IE11#730
Marc-Andre-Rivet merged 9 commits intodevfrom
ie11-numeric-input

Conversation

@shammamah-zz
Copy link
Copy Markdown
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


getValueAsNumber(value) {
const numericValue = convert(value);
return numericValue % 1 === 0 ? Math.floor(numericValue) : numericValue;
Copy link
Copy Markdown
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
Copy Markdown
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.

getValueAsNumber(value) {
const numericValue = convert(value);
return numericValue % 1 === 0 ? Math.floor(numericValue) : numericValue;
return convert(value);
Copy link
Copy Markdown
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
Copy Markdown
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!

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
Copy Markdown
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