Skip to content

[#9712] fix <input type="number" /> value '.98' should not be equal to '0.98'. - #9714

Merged
nhunzaker merged 3 commits into
react:masterfrom
koubei-fe:fix-number-input
Jun 9, 2017
Merged

nhunzaker merged 3 commits into
react:masterfrom
koubei-fe:fix-number-input

Conversation

@pingan1927

@pingan1927 pingan1927 commented May 18, 2017 •

Copy link
Copy Markdown
Contributor

fix bug #9712

I found in 15.5.4 is NOT OK, but in 16.0.0-alpha.3 is ok.
In 16.0.0-alpha.3 the number type is not handled separately.

15.5.4 is NOT OK

16.0.0-alpha.3 is OK

the change is base on master. Maybe the pr is worth to accept.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at [email protected]. Thanks!

If you are contributing on behalf of someone else (eg your employer): the individual CLA is not sufficient - use https://developers.facebook.com/opensource/cla?type=company instead. Contact [email protected] if you have any questions.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@nhunzaker

Copy link
Copy Markdown
Contributor

Awesome. @pingan1927 thanks so much for putting this together! I'll have some time later today or tomorrow morning to give it a thorough review.

Thanks again for sending this out!

@pingan1927

Copy link
Copy Markdown
Contributor Author

I think the code after fixed from v15.5.4 is better than v16.0.0-alpha3. It can reduce the render times if the input type is number.
My job code need set the input type to number to trigger a custom keyboard in some App.
The Test engineer ask me to format eg '.98' to '0.98' if the user input it to avoid some confuse. But I can't do it now.
So, can you give me some solution to make the change '.98' to '0.98' work in React 15.5.4 or older version?

@pingan1927

Copy link
Copy Markdown
Contributor Author

@nhunzaker you forgot this PR?

@nhunzaker

Copy link
Copy Markdown
Contributor

@pingan1927 Sorry. Busy time... thanks for the ping. Checking it out now.

<NumberTestCase />
</TestCase>
<TestCase
title="decimal numbers"

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.

Nitpick: Could you capitalize "Decimal"?

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 have fixed it. Any Problem?

@nhunzaker nhunzaker left a comment •

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.

This looks good. My only outstanding concern is that it is possible that this is fixed on the 15.6-dev branch, which has related commits from 16-alpha:

https://github.com/facebook/react/blob/15.6-dev/src/renderers/dom/client/wrappers/ReactDOMInput.js#L216-L233

Either way, you've added an important tests/fixtures that I want to merge into the test suite.

So for next steps:

  • Let's figure out if the 15.6-dev branch exhibits the incorrect behavior.
  • If the upcoming 15.6 release works as intended, revert the ReactDOMInput changes, but let's keep the tests/fixtures
  • If 15.6 is not correct, let's figure out what needs to get sent over from master to address the fix.

I'm in the middle of a location move, so my availability isn't the best, but I will do my best to follow up later this week.

@aweary

aweary commented Jun 7, 2017 •

Copy link
Copy Markdown
Contributor

I tested with the 15.6 RC and verified that this is still broken there. Testing locally, this should also fix #9884. @nhunzaker I think we should move on this quickly so we can include it in 15.6.

@nhunzaker

Copy link
Copy Markdown
Contributor

@pingan1927

Copy link
Copy Markdown
Contributor Author

@nhunzaker So what should I do next?

@nhunzaker
nhunzaker merged commit 8ab56e5 into react:master Jun 9, 2017
@nhunzaker

Copy link
Copy Markdown
Contributor

@pingan1927 Nothing, this is great work! I did more testing on Chrome, Safari, Firefox, and IE11. Everything behaves as expected.

Let's get this on 15.6. Great work, @pingan1927! Thank you for your patience.

@gaearon

gaearon commented Jun 9, 2017

Copy link
Copy Markdown
Collaborator

cc @flarnie

@flarnie

flarnie commented Jun 9, 2017

Copy link
Copy Markdown
Contributor

@nhunzaker feel free to cherry-pick or merge to 15.6-dev if you didn't already, or I can do it in the morning. Awesome to see this fixed so fast. :)

flarnie pushed a commit to flarnie/react that referenced this pull request Jun 12, 2017
…ual to '0.98'. (react#9714)

* [react#9712] fix <input type="number" /> value ".98" should not be equal to "0.98".

* fix eslint error

* fix label error
flarnie added a commit that referenced this pull request Jun 12, 2017
…o '0.98'. (#9714) (#9929)

* [#9712] fix <input type="number" /> value ".98" should not be equal to "0.98".

* fix eslint error

* fix label error
mrizwanashiq pushed a commit to mrizwanashiq/react that referenced this pull request Jun 25, 2026
…ual to '0.98'. (react#9714)

* [react#9712] fix <input type="number" /> value ".98" should not be equal to "0.98".

* fix eslint error

* fix label error
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
…ual to '0.98'. (react#9714)

* [react#9712] fix <input type="number" /> value ".98" should not be equal to "0.98".

* fix eslint error

* fix label error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants