| Summary: | Form associated ElementInternals always reports customError when using setValidity | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Elizabeth Mitchell <lizmitchell> |
| Component: | Forms | Assignee: | Alexey Shvayka <ashvayka> |
| Status: | NEW --- | ||
| 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 | ||
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`. Might be reseting validity here: https://searchfox.org/wubkat/source/Source/WebCore/html/FormListedElement.cpp#266 by using validityCheck(); ? Pull request: https://github.com/WebKit/WebKit/pull/19434 |
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.