Web Components & Shadow DOM
How do you handle form-associated custom elements?
class CustomInput extends HTMLElement {
static formAssociated = true;
constructor() {
super();
this._internals = this.attachInternals();
this._value = '';
}
get value() { return this._value; }
set value(v) {
this._value = v;
this._internals.setFormValue(v);
}
}