I was more than three-quarters through rewriting the AgnosticUI components in Lit when I realized I had overlooked something crucial. My seemed solid and fired events correctly, but it lacked Form-Associated Custom Element (FACE) support, making it invisible to native submissions.
I became aware of this during a chat with my friend Marc van Neerven. We were discussing Web Components and Shadow DOM when Marc highlighted the importance of form association.
Motivated by the slight embarrassment of missing something fundamental, I began reading materials on ElementInternals and Form-Associated Custom Elements to understand how it worked. I knew native HTML form controls had built-in submission logic and FormData support, but was unaware of a FACE API.
It’s frustrating to think you’re done with a dozen form components only to find they don’t support basic form functionality. Wrapping a naive custom element in a and submitting it makes the browser unaware of the component. Setting a breakpoint on your submit handler reveals an empty FormData object.
That empty object is what the server receives. Moreover, calling form.reset() leaves custom fields filled, and a
