RESOLVED FIXED 261432
Form associated ElementInternals always reports customError when using setValidity
https://bugs.webkit.org/show_bug.cgi?id=261432
Summary Form associated ElementInternals always reports customError when using setVal...
Elizabeth Mitchell
Reported 2023-09-11 14:42:36 PDT
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
Ahmad Saleem
Comment 1 2023-09-12 12:47:45 PDT
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
Comment 2 2023-09-12 13:02:20 PDT
Might be reseting validity here: https://searchfox.org/wubkat/source/Source/WebCore/html/FormListedElement.cpp#266 by using validityCheck(); ?
Radar WebKit Bug Importer
Comment 3 2023-09-18 14:57:47 PDT
Alexey Shvayka
Comment 4 2023-10-23 11:40:12 PDT
Lukas Spirig
Comment 5 2025-03-08 07:53:50 PST
EWS
Comment 6 2025-03-10 00:04:23 PDT
Committed 291878@main (072d9cabfbfa): <https://commits.webkit.org/291878@main> Reviewed commits have been landed. Closing PR #42134 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.