material-ui: Input text type number misbehavior
- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
- Chrome version:
- 95.0.4638.54 (Official Build) (64-bit) (ubuntu)
- 95.0.4638.54 (Official Build) (64-bit) (windows)
- 94.0.4606.85 (Official Build) (Android 10)
- Firefox version: 93.0 (ubuntu)
- Safari version: Versão 15.0 (16612.1.29.41.4, 16612) (ios big sur)
When you writes a “e” in the input text type number, the “title” of the field comes back to the middle of input text:

- In firefox and safari you can write any digit

- In chrome for Android, we cannot write the letter
e, but we can force to write a dot in the end of the number, resulting in the same behavior

- If you write only number, that behavior not occurs

They occurs directly into the codesandbox example for the input text page in the current release version
https://codesandbox.io/s/vvitc?file=/demo.js
Expected Behavior 🤔
- Keep the title like this:

Steps to Reproduce 🕹
Steps:
- Enter in oficial sandbox environment https://codesandbox.io/s/vvitc?file=/demo.js
- Change any input text to
type="number" - Write the digit
e - Remove focus from input, the title of the input will go to the “default empty location”
Your Environment 🌎
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 30 (8 by maintainers)
I think there is a workaround for this issue, according to the doc. Passing
InputLabelProps={{ shrink: true }}as a prop to theTextFieldcomponent will avoid this situation.Okay, Thank you for the update. Will solve another issue 😃 😊
It seems that no one is working on that. I have made the changes and will work on the tests. Soon I will create a PR, if no one does first. 😃
I don’t think so. It is a good workaround though.
What if I have a form with multiple inputs? I would like them to have same look and feel. In case the form have a number or date input mixed with other text inputs, I would be forced to make all input labels to be shrunk.
I believe that issue should be properly resolved.
I would like to work on this