change event not firing when text entered in input[@type=number]
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
People
(Reporter: 1981km, Unassigned)
Details
Attachments
(1 file)
282 bytes,
application/xhtml+xml
|
Details |
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:90.0) Gecko/20100101 Firefox/90.0
Steps to reproduce:
- Open the attached document.
- Open Web Developer Tools' console.
- Enter something that's not a number in the input field.
- Commit the entered value (e.g. by clicking outside the control).
Actual results:
No output happens to the console.
This is pretty bad, indicating that the change event isn't firing. I want to alert the user if he enters a value which is not a natural number (I didn't include the full code, but it has attribute min="0" and call to checkValidity in the handler). This bug allows the check to be circumvented by first clearing the field, committing the empty value (this does cause handler call) and then focusing the field again and entering some text.
I've come up with adding required="" as a workaround. But it shouldn't be necessary. What if I do want the empty value to be valid (and e.g. mean 0 – just a matter of handling NaN in the script)? I could drop type="number" and deal with that manually, but it's cumbersome and semantically poorer.
Expected results:
The message "function validate called" should be displayed in the console.
Comment 1•4 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::DOM: Core & HTML' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.
Comment 2•3 years ago
|
||
Chrome behaves same, except that Chrome does not insert non-numeric characters from key press. So I think this really is bug 1398528.
Please reopen if you disagree.
Description
•