-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Which input types should readonly affect constraint validation for? #8133
Comments
cc @whatwg/forms |
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 ( So since the part of the spec defining 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. |
…pported' types (#35389) See whatwg/html#8133 and whatwg/html#8089
https://bugs.webkit.org/show_bug.cgi?id=240343 <rdar://93173726> Reviewed by Chris Dumez. We should only apply the readonly attribute on certain input types: https://html.spec.whatwg.org/multipage/input.html#do-not-apply Except in the constraint validation case (willValidate) for compat reasons, since it affects the :in-range/:out-of-range pseudo-classes, the relevant test has been updated to reflect that. This also was the resolution of whatwg/html#8133 in the HTML spec triage meeting. Also introduce isMutable() which corresponds to the spec concept of mutable form control. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-willValidate-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-willValidate.html: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/show-picker-disabled-readonly-expected.txt: * LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-willValidate-expected.txt: * LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/show-picker-disabled-readonly-expected.txt: Added. * Source/WebCore/html/BaseDateAndTimeInputType.cpp: (WebCore::BaseDateAndTimeInputType::valueMissing const): (WebCore::BaseDateAndTimeInputType::handleDOMActivateEvent): * Source/WebCore/html/ColorInputType.cpp: (WebCore::ColorInputType::isKeyboardFocusable const): * Source/WebCore/html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::HTMLFormControlElement): (WebCore::HTMLFormControlElement::parseAttribute): (WebCore::HTMLFormControlElement::computeWillValidate const): * Source/WebCore/html/HTMLFormControlElement.h: (WebCore::HTMLFormControlElement::supportsReadOnly const): (WebCore::HTMLFormControlElement::isReadOnly const): (WebCore::HTMLFormControlElement::isMutable const): (WebCore::HTMLFormControlElement::isDisabledOrReadOnly const): Deleted. * Source/WebCore/html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::updateType): (WebCore::HTMLInputElement::supportsReadOnly const): (WebCore::HTMLInputElement::showPicker): (WebCore::HTMLInputElement::matchesReadWritePseudoClass const): (WebCore::HTMLInputElement::createInnerTextStyle): * Source/WebCore/html/HTMLInputElement.h: * Source/WebCore/html/HTMLTextAreaElement.cpp: (WebCore::HTMLTextAreaElement::matchesReadWritePseudoClass const): * Source/WebCore/html/HTMLTextAreaElement.h: * Source/WebCore/html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::isInnerTextElementEditable const): * Source/WebCore/html/SearchInputType.cpp: (WebCore::SearchInputType::handleKeydownEvent): * Source/WebCore/html/TextFieldInputType.cpp: (WebCore::TextFieldInputType::valueMissing const): (WebCore::TextFieldInputType::handleKeydownEventForSpinButton): (WebCore::TextFieldInputType::shouldSpinButtonRespondToMouseEvents const): (WebCore::TextFieldInputType::shouldDrawCapsLockIndicator const): (WebCore::TextFieldInputType::shouldDrawAutoFillButton const): * Source/WebCore/html/shadow/SliderThumbElement.cpp: (WebCore::SliderThumbElement::handleTouchEvent): * Source/WebCore/html/shadow/TextControlInnerElements.cpp: (WebCore::SearchFieldCancelButtonElement::defaultEventHandler): (WebCore::SearchFieldCancelButtonElement::willRespondToMouseClickEventsWithEditability const): Canonical link: https://commits.webkit.org/253321@main
…onstraint validation on 'unsupported' types, a=testonly Automatic update from web-platform-tests readonly attribute should still affect constraint validation on 'unsupported' types (#35389) See whatwg/html#8133 and whatwg/html#8089 -- wpt-commits: b7eb2920ba4cea3af51fdc4e11eddacd26f9a3ac wpt-pr: 35389
…gi?id=240343 readonly attribute should only apply on certain input types https://bugs.webkit.org/show_bug.cgi?id=240343 <rdar://93173726> Reviewed by Chris Dumez. We should only apply the readonly attribute on certain input types: https://html.spec.whatwg.org/multipage/input.html#do-not-apply Except in the constraint validation case (willValidate) for compat reasons, since it affects the :in-range/:out-of-range pseudo-classes, the relevant test has been updated to reflect that. This also was the resolution of whatwg/html#8133 in the HTML spec triage meeting. Also introduce isMutable() which corresponds to the spec concept of mutable form control. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-willValidate-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-willValidate.html: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/show-picker-disabled-readonly-expected.txt: * LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-willValidate-expected.txt: * LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/show-picker-disabled-readonly-expected.txt: Added. * Source/WebCore/html/BaseDateAndTimeInputType.cpp: (WebCore::BaseDateAndTimeInputType::valueMissing const): (WebCore::BaseDateAndTimeInputType::handleDOMActivateEvent): * Source/WebCore/html/ColorInputType.cpp: (WebCore::ColorInputType::isKeyboardFocusable const): * Source/WebCore/html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::HTMLFormControlElement): (WebCore::HTMLFormControlElement::parseAttribute): (WebCore::HTMLFormControlElement::computeWillValidate const): * Source/WebCore/html/HTMLFormControlElement.h: (WebCore::HTMLFormControlElement::supportsReadOnly const): (WebCore::HTMLFormControlElement::isReadOnly const): (WebCore::HTMLFormControlElement::isMutable const): (WebCore::HTMLFormControlElement::isDisabledOrReadOnly const): Deleted. * Source/WebCore/html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::updateType): (WebCore::HTMLInputElement::supportsReadOnly const): (WebCore::HTMLInputElement::showPicker): (WebCore::HTMLInputElement::matchesReadWritePseudoClass const): (WebCore::HTMLInputElement::createInnerTextStyle): * Source/WebCore/html/HTMLInputElement.h: * Source/WebCore/html/HTMLTextAreaElement.cpp: (WebCore::HTMLTextAreaElement::matchesReadWritePseudoClass const): * Source/WebCore/html/HTMLTextAreaElement.h: * Source/WebCore/html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::isInnerTextElementEditable const): * Source/WebCore/html/SearchInputType.cpp: (WebCore::SearchInputType::handleKeydownEvent): * Source/WebCore/html/TextFieldInputType.cpp: (WebCore::TextFieldInputType::valueMissing const): (WebCore::TextFieldInputType::handleKeydownEventForSpinButton): (WebCore::TextFieldInputType::shouldSpinButtonRespondToMouseEvents const): (WebCore::TextFieldInputType::shouldDrawCapsLockIndicator const): (WebCore::TextFieldInputType::shouldDrawAutoFillButton const): * Source/WebCore/html/shadow/SliderThumbElement.cpp: (WebCore::SliderThumbElement::handleTouchEvent): * Source/WebCore/html/shadow/TextControlInnerElements.cpp: (WebCore::SearchFieldCancelButtonElement::defaultEventHandler): (WebCore::SearchFieldCancelButtonElement::willRespondToMouseClickEventsWithEditability const): Canonical link: https://commits.webkit.org/253321@main
Given this example:
data:text/html,<input type=range min=0 max=100 value=50><input type=range readonly min=0 max=100 value=50><style>input:in-range { appearance: none; border: 1px solid red; }</style>
:in-range
seems to be affected by whether an input is readonly, which makes sense when you read:but on the other hand, the spec says that readonly does not apply to input[type=range] : https://html.spec.whatwg.org/multipage/input.html#do-not-apply
By that logic, I would expect
readonly
to have no effect on the:in-range
selector forinput[type=range]
.WebKit & Firefox & Chrome all (probably unintentionally) have this incoherency, it is worth a clarification on whether:
The text was updated successfully, but these errors were encountered: