Date input validation doesn't enforce min and max values on keyboard input
Categories
(Core :: DOM: Core & HTML, defect, P3)
Tracking
()
People
(Reporter: mcorteel, Unassigned)
Details
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0
Steps to reproduce:
Date inputs don't display an error when the date is changed via keyboard input (either by typing a new date or with arrows) and the date is outside of the min - max range (see https://codepen.io/anon/pen/oOWyGV).
- Create an input with <input value="2019-04-11" min="2019-04-11"/>
- Click on the day, use the down arrow to decrement it.
Actual results:
It gets to 2019-04-10.
Expected results:
It should stay to the minimum of 2019-04-11.
I realize that validating the date when the user inputs numbers is tricky, but at least when the user uses arrows, the date should be blocked within the min/max range.
Reporter | ||
Updated•6 years ago
|
![]() |
||
Updated•6 years ago
|
Updated•6 years ago
|
According to https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#form-submission-algorithm:interactively-validate-the-constraints, interactive constraint validation is part of the form submission algorithm. That is, validation is only required to be done when attempting to submit the form.
Firefox, at least on Linux/Ubuntu 18.04, already colors the border of the <input>
element red, when the set date is outside of the set bounds. That's already a hint to the user.
From a web-developer's perspective, also https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date#Validation states "If you use min and max to restrict the available dates (see Setting maximum and minimum dates), supporting browsers will display an error if you try to submit a date that is outside the set bounds."
Therefore, I suggest to close this issue as invalid.
Comment 2•5 years ago
|
||
Duping forward to bug 1613280 to consolidate.
Description
•