question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

  1. Remove the input value and blur the input; the label will descend into the input.
  2. Focus the input again and type the letter e.
  3. Blur again.
  4. 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:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:16 (12 by maintainers)

github_iconTop GitHub Comments

3reactions
gnapsecommented, Oct 8, 2018

The workaround is to set the shrink property on the label

Couldn’t the library handle this? That is, if the input type equals “number”, then force the label shrink property?

0reactions
oliviertassinaricommented, Sep 4, 2018

Yes, exactly.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found