Closed
Bug 1264157
Opened 9 years ago
Closed 9 years ago
:in-range & :out-of-range CSS pseudo-classes shouldn't match disabled or readonly inputs
Categories
(Core :: CSS Parsing and Computation, defect)
Core
CSS Parsing and Computation
Tracking
()
RESOLVED
FIXED
mozilla50
People
(Reporter: mozilla, Assigned: wisniewskit)
References
(Blocks 1 open bug, )
Details
(Keywords: dev-doc-complete, html5, testcase, Whiteboard: [parity-chrome][parity-webkit][parity-safari])
Attachments
(2 files)
598 bytes,
text/html
|
Details | |
8.16 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
Steps to reproduce:
1. Open the attached testcase webpage in Firefox.
2. Observe the colors of the outlines of the <input>s.
What is the expected behavior?
The outlines should be green, indicating that the disabled or readonly <input type=number>s did not match the :in-range or :out-of-range CSS pseudo-classes.
What went wrong?
The outlines are orange and red, indicating that the disabled or readonly <input type=number>s matched the :in-range or :out-of-range CSS pseudo-classes.
----
Based on my reading of the HTML spec, :in-range and :out-of-range should never apply to disabled or readonly <input>s.
Per https://html.spec.whatwg.org/multipage/scripting.html#selector-in-range
> The :in-range pseudo-class must match all elements that are **candidates for constraint validation**, have range limitations, and [...]
> The :out-of-range pseudo-class must match all elements that are **candidates for constraint validation**, have range limitations, and [...]
Per https://html.spec.whatwg.org/multipage/forms.html#candidate-for-constraint-validation
> A submittable element is a **candidate for constraint validation** except when a condition has **barred the element from constraint validation**.
Per https://html.spec.whatwg.org/multipage/forms.html#the-readonly-attribute:barred-from-constraint-validation
> If the **readonly** attribute is specified on an input element, the element is **barred from constraint validation**.
Per https://html.spec.whatwg.org/multipage/forms.html#enabling-and-disabling-form-controls:-the-disabled-attribute:barred-from-constraint-validation
> If an element is **disabled**, it is **barred from constraint validation**.
Thus, disabled and readonly <input>s are barred from constraint validation, meaning they are not candidates for constraint validation, thus causing them to be disqualified by the 1st of the 3 conditions which are required for an element to match :in-range or :out-of-range.
Reporter | ||
Updated•9 years ago
|
Reporter | ||
Updated•9 years ago
|
Blocks: selectors-4
Reporter | ||
Updated•9 years ago
|
Reporter | ||
Updated•9 years ago
|
Whiteboard: [parity-chrome]
Reporter | ||
Updated•9 years ago
|
See Also: → https://bugs.webkit.org/show_bug.cgi?id=156530
Reporter | ||
Comment 1•9 years ago
|
||
This has now been fixed in both WebKit and Chrome.
See the respective bug links in the "See Also" field.
Whiteboard: [parity-chrome] → [parity-chrome][parity-webkit][parity-safari]
Assignee | ||
Comment 2•9 years ago
|
||
Here's a patch with a successful try-run: https://treeherder.mozilla.org/#/jobs?repo=try&revision=051bc37b198a&selectedJob=23605802
Note that until the time, week, and datetimelocal elements also correctly support range constraints, the web platform test will continue to fail. As such I added a mochitest in the patch just for this bug, which can be removed when the time comes.
![]() |
||
Comment 3•9 years ago
|
||
Comment on attachment 8769503 [details] [diff] [review]
1264157-do_not_match_disabled_or_readonly_inputs_with_in-range_or_out-of-range.diff
r=me
Can you check this in yourself, or do you need someone to check it in for you?
Flags: needinfo?(wisniewskit)
Attachment #8769503 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 4•9 years ago
|
||
No, I can set checkin-needed, but I don't have actual commit privileges yet.
Flags: needinfo?(wisniewskit)
![]() |
||
Comment 5•9 years ago
|
||
OK. Let's set that, and if the sheriffs haven't gotten to this by tomorrow I'll get it landed.
Thank you for the patch!
Keywords: checkin-needed
Pushed by cbook@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/cee7b4d83f04
Do not match disabled/readonly inputs with :in-range and :out-of-range. r=bz
Keywords: checkin-needed
Comment 7•9 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox50:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
Comment 8•9 years ago
|
||
I've added a compatibility note for this to https://developer.mozilla.org/en-US/docs/Web/CSS/:in-range#Browser_compatibility.
Sebastian
Keywords: dev-doc-complete
Comment 9•9 years ago
|
||
I think this is worth a mention in Firefox 50 for devs too.
Keywords: dev-doc-complete → dev-doc-needed
Comment 10•9 years ago
|
||
(In reply to Jean-Yves Perrier [:teoli] from comment #9)
> I think this is worth a mention in Firefox 50 for devs too.
Added.
Sebastian
Keywords: dev-doc-needed → dev-doc-complete
You need to log in
before you can comment on or make changes to this bug.
Description
•