Form associated element

<form>
  <my-ce></my-ce>
</form>

<script>
  class MyCe extends HTMLElement {
    static formAssociated = true
  }
  customElements.define('my-ce', MyCe)
</script>

Define formAssociated static property

Set the formAssociated static property to true to indicate that the custom element is form-associated.