Closed calebdwilliams closed 2 years ago
Using the scoped elements registry breaks formAssociated components, somehow any formAssociated getter doesn't get set on the elements.
formAssociated
You can find a reproduction on this StackBlitz demo.
import '@webcomponents/scoped-custom-element-registry'; class Whatever extends HTMLElement { static get formAssociated() { return true; } internals = this.attachInternals(); connectedCallback() { this.internals.setFormValue('foo'); } } customElements.define('what-ev', Whatever); document.getElementById('form').addEventListener('submit', (event) => { event.preventDefault(); console.log(new FormData(event.target).get('whatever')); }); const wrapper = document.createElement('div'); wrapper.innerHTML = `<form> <what-ev></what-ev> </form>`; /** * The above throws the following error * preview-a214a06f7a20.js:2 DOMException: Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element. */
Form associated behavi
0.0.3
This is fixed in version 0.0.4. Thanks all!
Description
Using the scoped elements registry breaks
formAssociated
components, somehow any formAssociated getter doesn't get set on the elements.Example
You can find a reproduction on this StackBlitz demo.
Steps to reproduce
Expected behavior
Form associated behavi
Actual behavior
Version
0.0.3
Browsers affected