lwc icon indicating copy to clipboard operation
lwc copied to clipboard

Form-Associated Custom Elements (FACE) and ElementInternals are not supported for `CustomElementConstructor`

Open nolanlawson opened this issue 1 year ago • 1 comments

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:

nolanlawson avatar Jan 03 '24 21:01 nolanlawson

This issue has been linked to a new work item: W-15191696

git2gus[bot] avatar Mar 06 '24 07:03 git2gus[bot]