The page describing the use of input type=‘date’ describes readonly
as if it was a special attribute relevant to type=‘date’, like the min
and max
attributes, rather than as a global attribute applicable to all form elements.
Also this description includes a paragraph which is repeated elsewhere on the site:
Note: Because a read-only field cannot have a value, required
does not have any effect on inputs with the readonly
attribute also specified.
But of course read-only fields can and almost always do have a value, but that value cannot be modified by the user. This paragraph should read “The required
attribute is not permitted on inputs with the readonly
attribute specified.” The browser should log a diagnostic warning thatrequired
, and all of the other constraint attributes, is ignored for input elements which have readonly
because the HTML5 standard says “if the readonly attribute is specified on an input element, the element is barred from constraint validation.”.