Bug 261432
Summary: | Form associated ElementInternals always reports customError when using setValidity | ||
---|---|---|---|
Product: | WebKit | Reporter: | Elizabeth Mitchell <lizmitchell> |
Component: | Forms | Assignee: | Alexey Shvayka <ashvayka> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | ahmad.saleem792, akeerthi, ashvayka, cdumez, j.graseec, webkit-bug-importer, wenson_hsieh |
Priority: | P2 | Keywords: | BrowserCompat, InRadar |
Version: | Safari 16 | ||
Hardware: | Mac (Apple Silicon) | ||
OS: | macOS 13 | ||
URL: | https://jsbin.com/nodibatala/edit?html,output |
Elizabeth Mitchell
A form associated custom element can call `internals.setValidity(flags)`. If `customError` is missing or set to `false` in the flags, `internals.validity.customError` always reports true, as long as one of the validity flags is set to true.
```
<script>
class XControl extends HTMLElement {
static formAssociated = true;
constructor() {
super();
this.internals = this.attachInternals();
this.internals.setValidity({valueMissing: true, customError: false}, 'Value missing');
// Expecting "customError: false"
alert(`customError: ${this.internals.validity.customError}`);
}
}
customElements.define('x-control', XControl);
</script>
<x-control></x-control>
```
Repro: https://jsbin.com/nodibatala/edit?html,output
Expectation: open the repro and get an alert of "customError: false". This works in Chrome and Firefox
Actual: Safari 16.6 reports "customError: true", even when customError is set to false.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Ahmad Saleem
I am able to reproduce this bug in WebKit ToT (267909@main) and get `customError: true` while Firefox Nightly 118 and Chrome Canary 118 get `customError: false`.
Ahmad Saleem
Might be reseting validity here: https://searchfox.org/wubkat/source/Source/WebCore/html/FormListedElement.cpp#266
by using validityCheck(); ?
Radar WebKit Bug Importer
<rdar://problem/115681066>
Alexey Shvayka
Pull request: https://github.com/WebKit/WebKit/pull/19434
Lukas Spirig
Pull request: https://github.com/WebKit/WebKit/pull/42134
EWS
Committed 291878@main (072d9cabfbfa): <https://commits.webkit.org/291878@main>
Reviewed commits have been landed. Closing PR #42134 and removing active labels.