lwc
lwc copied to clipboard
Form-Associated Custom Elements (FACE) and ElementInternals are not supported for `CustomElementConstructor`
Description
If you try to use static formAssociated = true or this.attachInternals() with a component that was created using CustomElementConstructor, then it will not work. The browser will throw an error:
Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a
form-associated custom element
The root cause is that CustomElementConstructor never sets static formAssociated = true on the class it registers with customElements.define().
Currently, FACE and ElementInternals are only supported for non-CustomElementConstructor components, and only in native shadow DOM and native custom element lifecycle.
Repros:
This issue has been linked to a new work item: W-15191696