[WICG/webcomponents] Form associated custom elements: cross shadow root form participation (Issue #1075)

[Consider this](https://lit.dev/playground/#gist=ce5c1f76b485e7f0463a7957b8b85246): 

1. An element holding a textfield: 

```js
@customElement('my-wrapped-field')
export class MyWrappedField extends LitElement {
  @property() label!: string
  render() {
    return html`
        <md-filled-text-field .label=${this.label} required></md-filled-text-field>
        `;
    }
}
```

2. Placed within a form 
```html
<form>
     <md-filled-text-field label="I participate to the form" required></md-filled-text-field>
     <my-wrapped-field label="I will not"></my-wrapped-field>
     <div>
        <md-filled-button>Submit</md-filled-button>
     </div>
<form>
```

The `md-filled-text-field` within the `my-wrapped-field` does not participate in the form (its `.form` is `null`) as it is not in the same shadow root. 

Is there / will there be a way to pass the form to the `my-wrapped-field` so that such nested form participation construct could work?







-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/1075
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/1075@github.com>

Received on Sunday, 6 October 2024 12:19:04 UTC