element-required-attributes: type on input should not be required
Currently, when validating an input with no type
attribute set, it fails validation because the html-validate elements metadata specifies type
as a required attribute: https://gitlab.com/html-validate/html-validate/-/blob/master/src/elements/html5.ts#L1156.
However, in case the attribute is missing, it should default to type="text"
according to the spec: https://html.spec.whatwg.org/multipage/input.html#the-input-element
My real-life use case here is that we use react-select
, which renders a dummy input without a type attribute - this unfortunately causes all pages that use our Select component to be reported as invalid. I could of course go and try fixing this in react-select as well, though that repo is a bit undermaintained.
Unless there are good reasons for keeping this attribute as required, could we remove the flag?
Reduced test-case
<input />
Configuration
{
"rules": {
"element-required-attributes": "error"
}
}
Expected result
The provided HTML should be valid.
Actual result
The HTML was reported to be invalid
Version
-
html-validate
: 8.9.1