| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
constraint validation. The current implementation does not bar
constraint validation by default, but bars it when the element is
readonly. However, for button [2] and select [3], the barred conditionWhere is the code that is already doing this? Should it be removed since this patch adds new code seemingly for add ListedElements?
bool ReadOnlyBarsFromConstraintValidation() const final { return true; }Is this tested? It seems like the test changes are only for the select and button elements, but not custom elements.
virtual bool ReadOnlyBarsFromConstraintValidation() const { return false; }I think "Prevents" would be easier to read than "BarsFrom"
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
virtual bool ReadOnlyBarsFromConstraintValidation() const { return false; }I think "Prevents" would be easier to read than "BarsFrom"
+1. Also, could you please add a link above this to the spec:
!(is_readonly_ && ReadOnlyBarsFromConstraintValidation());Two things:
1. I think this would be a bit easier to read:
`(!is_readonly_ || !ReadOnlyPreventsConstraintValidation())`
and 2. I think this needs a runtime enabled feature flag guard. It's a small change, but you never know what it might break.
bool ReadOnlyBarsFromConstraintValidation() const final { return true; }Add link to spec please
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
constraint validation. The current implementation does not bar
constraint validation by default, but bars it when the element is
readonly. However, for button [2] and select [3], the barred conditionWhere is the code that is already doing this? Should it be removed since this patch adds new code seemingly for add ListedElements?
This is [the part](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/html/forms/listed_element.cc;l=373?q=third_party%2Fblink%2Frenderer%2Fcore%2Fhtml%2Fforms%2Flisted_element.cc&ss=chromium). I think I wrote the commit message in a confusing way. I was trying to say that the current implementation bars all elements when they are readonly.
So this code should not be removed. Instead, it should find elements that are readonly and whose constraint validation is prevented by readonly.
If I understand your point correctly, I'll update the commit message.
bool ReadOnlyBarsFromConstraintValidation() const final { return true; }Is this tested? It seems like the test changes are only for the select and button elements, but not custom elements.
I think it's being verified in [this test](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/external/wpt/custom-elements/form-associated/ElementInternals-validation.html;l=54-58?q=ElementInternals-validation&ss=chromium). But would it be better to add a new test under form to make it clearer?
virtual bool ReadOnlyBarsFromConstraintValidation() const { return false; }Mason FreedI think "Prevents" would be easier to read than "BarsFrom"
+1. Also, could you please add a link above this to the spec:
Done!
!(is_readonly_ && ReadOnlyBarsFromConstraintValidation());Two things:
1. I think this would be a bit easier to read:
`(!is_readonly_ || !ReadOnlyPreventsConstraintValidation())`
and 2. I think this needs a runtime enabled feature flag guard. It's a small change, but you never know what it might break.
Agreed. I've added a feature flag!
bool ReadOnlyBarsFromConstraintValidation() const final { return true; }Add link to spec please
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
constraint validation. The current implementation does not bar
constraint validation by default, but bars it when the element is
readonly. However, for button [2] and select [3], the barred conditionYeongHan KimWhere is the code that is already doing this? Should it be removed since this patch adds new code seemingly for add ListedElements?
This is [the part](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/html/forms/listed_element.cc;l=373?q=third_party%2Fblink%2Frenderer%2Fcore%2Fhtml%2Fforms%2Flisted_element.cc&ss=chromium). I think I wrote the commit message in a confusing way. I was trying to say that the current implementation bars all elements when they are readonly.
So this code should not be removed. Instead, it should find elements that are readonly and whose constraint validation is prevented by readonly.If I understand your point correctly, I'll update the commit message.
Acknowledged
bool ReadOnlyBarsFromConstraintValidation() const final { return true; }YeongHan KimIs this tested? It seems like the test changes are only for the select and button elements, but not custom elements.
I think it's being verified in [this test](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/external/wpt/custom-elements/form-associated/ElementInternals-validation.html;l=54-58?q=ElementInternals-validation&ss=chromium). But would it be better to add a new test under form to make it clearer?
So if you removed this added method, then that test would fail?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
LGTM, but please wait for Joey's LGTM also.
// Whether the readonly attribute prevents from constraint
// validation depends on the submittable element.nit:
```
When enabled, the readonly attribute will prevent constraint validation
only in some cases, depending on the element.
```
// This was added in M146 and can be removed after M148.It looks like this will land in M147, and can be removed after M149.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
bool ReadOnlyBarsFromConstraintValidation() const final { return true; }YeongHan KimIs this tested? It seems like the test changes are only for the select and button elements, but not custom elements.
Joey ArharI think it's being verified in [this test](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/external/wpt/custom-elements/form-associated/ElementInternals-validation.html;l=54-58?q=ElementInternals-validation&ss=chromium). But would it be better to add a new test under form to make it clearer?
So if you removed this added method, then that test would fail?
No, it won't fail.
Here's a summary of the changes:
For [custom elements](https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-core-concepts), since readonly is a condition that should prevent validation, the result doesn't change.
The elements affected by this change are button and select.
// Whether the readonly attribute prevents from constraint
// validation depends on the submittable element.nit:
```
When enabled, the readonly attribute will prevent constraint validation
only in some cases, depending on the element.
```
Done!
// This was added in M146 and can be removed after M148.It looks like this will land in M147, and can be removed after M149.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
bool ReadOnlyBarsFromConstraintValidation() const final { return true; }YeongHan KimIs this tested? It seems like the test changes are only for the select and button elements, but not custom elements.
Joey ArharI think it's being verified in [this test](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/external/wpt/custom-elements/form-associated/ElementInternals-validation.html;l=54-58?q=ElementInternals-validation&ss=chromium). But would it be better to add a new test under form to make it clearer?
YeongHan KimSo if you removed this added method, then that test would fail?
No, it won't fail.
Here's a summary of the changes:
- AS-IS: Prevents constraint validation for all elements when readonly
- TO-BE: Only prevents constraint validation for elements whose condition for preventing validation is readonly
For [custom elements](https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-core-concepts), since readonly is a condition that should prevent validation, the result doesn't change.
The elements affected by this change are button and select.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Fix readonly elements incorrectly barred from constraint validation
According to [1], a submittable element is a candidate for constraint
validation except when a condition has barred the element from
constraint validation. The current implementation does not bar
constraint validation by default, but bars it when the element is
readonly. However, for button [2] and select [3], the barred condition
is not readonly, so they are incorrectly barred from constraint
validation.
So, this patch changes the behavior so that elements are not barred from
constraint validation even if they are readonly, and only elements whose
barred condition includes readonly are barred. The elements whose barred
condition includes readonly are input, textarea, and custom elements.
[1] https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#barred-from-constraint-validation
[2] https://html.spec.whatwg.org/multipage/form-elements.html#the-button-element:barred-from-constraint-validation
[3] https://html.spec.whatwg.org/multipage/form-elements.html#the-select-element:barred-from-constraint-validation
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |