HTML input elements with type number should only be valid when a number is passed.
See original GitHub issueCurrently the checkValidity()
method on an input element of type number only checks the lower and the upper bound of the value that is passed. When something is passed that isn’t a number at all checkValidity()
returns true
although it should return false
.
I’ll open a pull request that demonstrates the problem and suggests a fix in a minute.
Issue Analytics
- State:
- Created 3 years ago
- Comments:25 (25 by maintainers)
Top Results From Across the Web
<input type="number"> - HTML: HyperText Markup Language
A number input is considered valid when empty and when a single number is entered, but is otherwise invalid. If the required attribute...
Read more >Number input type that takes only integers? - Stack Overflow
It's been working great so far except for one thing. In the HTML5 specification, the input type "number" can have both integers and...
Read more >Why the number input is the worst input - Stack Overflow Blog
When the number input contains an invalid value and you retrieve the value, you get a blank string. Valid numbers include more than...
Read more >Making HTML 5 Numeric Inputs Only Accept Integers - Medium
The Fix? Use the pattern and step attributes so as to restrict what's valid. Issue #2, Bad Or incomplete Regex Patterns.
Read more >lightning-input - documentation - Salesforce Developers
To specify valid increments for numerical fields, use the step attribute. The value of step constrains the numbers that users can enter. If...
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
I think it should be the right Snapshot:
if (!valueAttr.isEmpty()) {
which was introduced by that commit.2.48.0-SNAPSHOT
before so this morning should be the first time when it was downloaded.Mis… - was moved to spam.