ember-test-helpers icon indicating copy to clipboard operation
ember-test-helpers copied to clipboard

Input events should be instantiated with `{ composed: true }`

Open mmun opened this issue 2 years ago • 2 comments

The composed property determines whether an event that occurs in shadow DOM will bubble to the host element.

Link to MDN docs.

In HTML, all form control input events are composed [^1] [^2].

Presently, we are not instantiating input events with { composed: true }. See for example fillIn and select. I have not looked if there are other places. It probably makes sense to make this change in fireEvent itself similar to how bubbles is true by default.

[^1]: Search for "Fire an event named input" on https://html.spec.whatwg.org/multipage/input.html and https://html.spec.whatwg.org/multipage/form-elements.html.

[^2]: Change events are not composed.

mmun avatar Mar 03 '22 17:03 mmun

Totally agree, thank you for noticing and reporting!

rwjblue avatar Apr 11 '22 16:04 rwjblue

Here's a list of events that should be instantiated with { composed: true }:

https://github.com/WICG/webcomponents/issues/513#issuecomment-224183937

mmun avatar Apr 13 '22 14:04 mmun