TextField type Number vs number
See original GitHub issueWhen using a textField there seems to be a difference between type: “Number” and type: "number
I could not find this in the documentation anywhere. (Maybe I missed something?)
What we were running into was if type: "number"
then when the user would type a number there would remain a leading zero.
0 -> type number 5 -> value shows 05
when type: "Number"
0 -> type number 5 -> value shows 5
- This is not a v0.x issue.
- I have searched the issues of this repository and believe that this is not a duplicate.
Steps to Reproduce 🕹
please see this sandbox https://codesandbox.io/s/m4yk0n7kzy click into the field. enter a number you will see a leading 0. change the type, and the problem goes away.
Note: I have not found that you can reproduce the problem by using the arrows.
| Material-UI | v3.5.1 | | React | 16.4 | | Browser | chrome |
it is possible that this was intended functionality, but I am doubtful, seeing that the arrows to not produce the same behavior.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
@AirborneEagle I would encourage you to try StackOverflow out. We focus on issues with the library here 😃.
@joshwooding 😮 That is messed up.
@oliviertassinari I highly admire your work. Why should Number() not be used in the control/feedback loop? Would it be better to do something like shown below?
So if I am understanding correctly, then I am simply need to implement my own workaround. something like this? (Plain text field, with a unary operation when setting the value to remove the leading 0)
I understand that this is not a Material-UI issue. But does anyone know why the native number field behaves that way?