- From: Carlos Lopez <notifications@github.com>
- Date: Thu, 29 Jun 2023 08:16:54 -0700
- To: WICG/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <WICG/webcomponents/issues/1016@github.com>
When creating a custom checkbox, the requirements for throwing a `click`, `input`, and `change` event can successfully clone all the native `<input type=checkbox>` implementation except for `.isTrusted` on change. Because the `change` event is not `composed`, it must be rethrown. eg: ````js this.shadowRoot.onchange = (e) => this.dispatchEvent(new Event(e.type, e)); ```` ````html <x-checkbox> #shadow-root <input type=checkbox> </x-checkbox> ```` This isn't a bug or an error, but a limitation of WC. Any instance of change references to `<input type=checkbox>` to `<x-checkbox><x-checkbox>` need to have all their code inspected for `isTrusted` and ignore the value. To note, `input` is `composed`, so these interactions will stay the same. ------------ Use case: I'm rebuilding custom `<x-checkbox>` and testing them again the WPT tests for `<input type=checkbox>` here: https://wpt.fyi/results/html/semantics/forms/the-input-element/checkbox.html Satisfying the trusted state is impossible. ------------ Perhaps there can be a mechanic where an event may remain trusted as long as it is dispatched by the host of the shadowRoot. In other words, `this.redispatchEvent(e)` can internally clone the event with the host as the target, keeping all properties the same. I know crossing boundaries is a somewhat of a pain point for events. -- Reply to this email directly or view it on GitHub: https://github.com/WICG/webcomponents/issues/1016 You are receiving this because you are subscribed to this thread. Message ID: <WICG/webcomponents/issues/1016@github.com>
Received on Thursday, 29 June 2023 15:17:00 UTC