Project: chromium Issues People Development process History Sign in
New issue
Advanced search Search tips
Starred by 3 users
Status: Fixed
Owner:
Closed: Apr 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment
:in-range & :out-of-range CSS pseudo-classes shouldn't match disabled or readonly inputs
Reported by cvreb...@gmail.com, Apr 12 2016 Back to list
UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36

Steps to reproduce the problem:
1. Open the attached testcase webpage in Chrome.
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.

Did this work before? N/A 

Chrome version: 52.0.2705.0  Channel: canary
OS Version: OS X 10.11.4
Flash Version: Shockwave Flash 21.0 r0

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.
 
testcase.html
598 bytes View Download
Components: Blink>CSS
Labels: -OS-Mac
Owner: tha...@chromium.org
Status: Assigned
Reproduced locally. I doubt that this is Mac-specific, and I'm pretty sure it's a Blink bug. I'll assign this to thakis@ (who is in blink core/OWNERS) for investigation or further routing.
Comment 2 by r...@opera.com, Apr 13 2016
The spec references look valid to me. Firefox has the same issue. Did you report this for Firefox as well?

Comment 4 by tha...@chromium.org, Apr 13 2016
Owner: ----
Status: Untriaged
I can guarantee I won't get to this.
Comment 6 by r...@opera.com, Apr 13 2016
Owner: r...@opera.com
Status: Started
https://codereview.chromium.org/1890633002/
Comment 7 by cvreb...@gmail.com, Apr 13 2016
See also  Issue 603268 
Project Member Comment 8 by bugdroid1@chromium.org, Apr 14 2016
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/cb289485c838f65f92a48813704b7671388c6c62

commit cb289485c838f65f92a48813704b7671388c6c62
Author: rune <rune@opera.com>
Date: Thu Apr 14 07:46:34 2016

Check willValidate() for :in-range and :out-of-range.

:in-range and :out-of-range should only match elements which are
candidates for constraint validation[1], and they are not when they are
disabled or read-only.

https://html.spec.whatwg.org/multipage/scripting.html#selector-in-range

R=tkent@chromium.org
BUG= 602568 

Review URL: https://codereview.chromium.org/1890633002

Cr-Commit-Position: refs/heads/master@{#387258}

[delete] https://crrev.com/d03ae7a55e5f914eff4683634cc13354ceb1eac1/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/selectors/pseudo-classes/inrange-outofrange-expected.txt
[modify] https://crrev.com/cb289485c838f65f92a48813704b7671388c6c62/third_party/WebKit/Source/core/html/HTMLInputElement.cpp

Comment 9 by r...@opera.com, Apr 14 2016
Status: Fixed
Comment 10 by tkent@chromium.org, Apr 14 2016
Labels: M-52
Sign in to add a comment