TextField with type=number treats makes label overlap invalid values
See original GitHub issue- This is a v1.x issue.
- I have searched the issues of this repository and believe that this is not a duplicate.
Expected Behavior
When you enter an invalid value into TextField
of type="number"
the label should stay where it was - above the value.
Current Behavior
After the input with an invalid value is blurred the label starts overlapping the value.
Steps to Reproduce
Link: https://codesandbox.io/s/y0ykr6zo5z
- Remove the input value and blur the input; the label will descend into the input.
- Focus the input again and type the letter
e
. - Blur again.
- See how the label descends, covering the just written
e
.
Context
The reason for this issue is that input
with type="number"
will set its value
field to an empty string if the entered value is invalid. The only way to distinguish that from an empty field is to check for the input validity.badInput
field. See this example: https://jsfiddle.net/py7fbxtu/5/
Your Environment
Tech | Version |
---|---|
Material-UI | v3.0.1 & v1.4.3 |
React | v16.3.2 |
Browser | Chrome 68.0.3440.106 |
TypeScript | N/A |
etc. |
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:16 (12 by maintainers)
Top Results From Across the Web
TextField with type=number treats makes label overlap invalid ...
When you enter an invalid value into TextField of type="number" the label should stay where it was - above the value. Current Behavior....
Read more >React Material UI Label Overlaps with Text - Stack Overflow
This is due to the undefined state of the value. This workaround works for me as a fallback: value= this.state.name || '';.
Read more >bcftools(1) Manual Page - Samtools
When multiple regions overlap a single record, this option defines how to treat multiple annotation values when setting tag in the destination file:...
Read more >Dygraphs — options reference
Show data labels in an external div, rather than on the graph. This value can either be a div element or a div...
Read more >Histogram | Charts - Google Developers
A histogram is a chart that groups numeric data into bins, displaying the bins as segmented columns. They're used to depict the distribution...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Couldn’t the library handle this? That is, if the input type equals “number”, then force the label shrink property?
Yes, exactly.