WICG / webcomponents

Web Components specifications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does form association need to be per-class, or could it be per-instance?

justinfagnani opened this issue · comments

In investigating an issue with the scoped custom element registry polyfill - where we need to provide customElements.define() with a single value for formAssociated for potentially many different element definitions - I had the question of why form-association is a class-level concern rather than an instance-level concern.

With ElementInternals, could we not have a .formAssociated property?

One reason to not just always make an element form-associated if any of its instances might be form-associated is that form-association changes the behavior of the element in some significant ways. In the above issue it's that a form-associated element can't be disabled and focused as the same time, while a non-form-associated element can (more accurately, the disabled attribute has no default effect).