You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Which input types should readonly affect constraint validation for? #8133
I think a strict reading of the spec supports current browser behavior. "do not apply" is a boolean predicate, and what effects it has are determined by other parts of the spec, which consult that predicate.
Just because "do not apply" = true for (<input type=range>, readonly=""), that doesn't mean "everything to do with readonly stops applying to <input type=range>". (For example, basic behaviors like the fact that rangeInput.setAttribute("readonly", "") causes rangeInput.hasAttribute("readonly") to return true, or rangeAttribute.matches("[readonly]"), still "apply".)
So since the part of the spec defining :in-range doesn't consult the "do not apply" predicate, there's no impact.
This could be clarified by renaming "do not apply" to something like "mostly doesn't apply" or "has most features disabled", I suppose, and explaining the above.
When an attribute doesn't apply to an input element, user agents must ignore the attribute, regardless of the requirements and definitions below.
It does not say how much they must ignore it. The constraint validation added by the presence of readonly is one of the definitions below, whose section does not define much else.
So instead of rewording do not apply, perhaps this paragraph could just be extended by adding an exception for when consulting the presence of the attribute, rather than consulting whether it applies on the input type.
Activity
annevk commentedon Jul 27, 2022
cc @whatwg/forms
domenic commentedon Jul 29, 2022
I think a strict reading of the spec supports current browser behavior. "do not apply" is a boolean predicate, and what effects it has are determined by other parts of the spec, which consult that predicate.
Just because "do not apply" = true for (
<input type=range>,readonly=""), that doesn't mean "everything to do withreadonlystops applying to<input type=range>". (For example, basic behaviors like the fact thatrangeInput.setAttribute("readonly", "")causesrangeInput.hasAttribute("readonly")to return true, orrangeAttribute.matches("[readonly]"), still "apply".)So since the part of the spec defining
:in-rangedoesn't consult the "do not apply" predicate, there's no impact.This could be clarified by renaming "do not apply" to something like "mostly doesn't apply" or "has most features disabled", I suppose, and explaining the above.
Bug 1783760 [wpt PR 35389] - readonly attribute should still affect c…
Cherry-pick 253321@main (af43ca3). https://bugs.webkit.org/show_bug.c…
Cherry-pick af43ca3. rdar://problem/93173726
cdoublev commentedon Feb 12, 2026
§ 4.10.5.3 Common input element attributes requires user agents to ignore
readonlywhen it does not apply to the input element.It does not say how much they must ignore it. The constraint validation added by the presence of
readonlyis one of the definitions below, whose section does not define much else.So instead of rewording do not apply, perhaps this paragraph could just be extended by adding an exception for when consulting the presence of the attribute, rather than consulting whether it applies on the input type.
dbaron commentedon Apr 3, 2026
#8089 (comment) reported general agreement with the proposal above in #8133 (comment)
I think the spec could certainly use some clarification here, though. (And the current situation doesn't really make sense.)
Clean up and document readonly constraint validation behavior
Constraint validation checks readonly for all input types