-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
input
event is composed but change
isn't
#5453
Comments
Currently neither is composed, at least according to the spec. E.g. https://html.spec.whatwg.org/multipage/input.html#common-input-element-events says
neither of which mention the composed flag. I can understand wanting them both to be composed, though. And it sounds like you've tested and at least some browsers have input as a composed event? /cc @whatwg/components @mfreed7. |
Making input and change composed would reveal internals of Shadow DOM, and Shadow DOM wouldn't have ways to prevent light DOM to handle them before (capture phase) it handles them itself. Unfortunately https://w3c.github.io/uievents/#event-type-input defines input and beforeinput as composed. |
@smaug---- is correct that it is defined as composed in the UI events spec. WICG/webcomponents#513 is where it was first suggested and I didn't see any disagreement there and then w3c/uievents#91 is what made the change with the comment "Reflect the conclusion of WICG/webcomponents#513." I thought I also saw composed being set to true before dispatch in a spec but maybe I'm wrong about that and was looking at the UI Events PR.
Yes, |
Code that assists users with filling forms will struggle on pages using Shadow DOM without composed |
The UI events tables are not normative and should not be used for implementation. Unfortunately it sounds like maybe they were in some browsers. |
At this point is there any realistic chance UAs can change the |
As far as I could tell, these behaviors were implemented before we refactored the spec to specify composed flag in each place. Previously, we determined based on the event type so it looks like input event was one of causalities during that transition. Given all browsers have been shipping this way for a while, it's probably hard to change this behavior now :( |
I'll work on a pull request and tests to specify input as composed and change as non-composed, just to get the spec to match reality. If any implementers are interested in changing this (e.g. @smaug---- seems in favor of making both non-composed) then please let us know. Otherwise I will assume that folks are reluctant to change, given the potential for compat problems. /cc @mfreed7 |
This is how things have been implemented in all browsers, probably based off of the definitions in the UI Events specification. See also the discussion in #5453. This includes an editorial change to deduplicate some repeated text in the <input type=file> section.
See whatwg/html#5453. The <select> test doesn't appear to work on Safari, but I can't figure out how to fix it without a Mac.
FWIW, I'm less concerned about the shadow tree leak here. Being able to observe that it contains something that would cause this event to be dispatched is fine and doesn't seem all that different from It does seem concerning that UI Events defines some of this as no upstreaming takes place. That is, UI Events defines |
This is how things have been implemented in all browsers, probably based off of the definitions in the UI Events specification. See also the discussion in #5453. This includes an editorial change to deduplicate some repeated text in the <input type=file> section.
…perties, a=testonly Automatic update from web-platform-tests Add tests for input and change event properties See whatwg/html#5453. The <select> test doesn't appear to work on Safari, but I can't figure out how to fix it without a Mac. -- wpt-commits: 47f659d346db0b1ed0d336fdee81a16214f2a6d1 wpt-pr: 24995
This is how things have been implemented in all browsers, probably based off of the definitions in the UI Events specification. See also the discussion in whatwg#5453. This includes an editorial change to deduplicate some repeated text in the <input type=file> section.
…perties, a=testonly Automatic update from web-platform-tests Add tests for input and change event properties See whatwg/html#5453. The <select> test doesn't appear to work on Safari, but I can't figure out how to fix it without a Mac. -- wpt-commits: 47f659d346db0b1ed0d336fdee81a16214f2a6d1 wpt-pr: 24995
We discussed this is in the triage meeting (#6739) and came to the conclusion the spec should stay as-is, and is somewhat justifiable, although in this case it's a bit strange. In general, only very special events should be On the other hand, events like
Combined with the compat concerns about changing behavior where all browsers agree, we think |
In WICG/webcomponents#513 (comment) the idea of making the
change
event usecomposed: true
was raised but I didn't see any further discussion on this and now I think there is inconsistency with respect toinput
vs.change
events. The former usescomposed: true
whereas the latter does not yet they are very similar events, at least on text<input>
s. I can't think of a reason why it would be desirable to have this discrepancy between the two. It seems like this was an unfortunate oversight unless this was discussed in a meeting and didn't make it back into the issue.The MDN page for Event.composed currently states:
which I would consider incorrect given that many would consider the
change
event a UI event (lowercase e).I assume the main reason why the
change
event isn't part of the UI Events specification is because it doesn't use a subclass ofEvent
for historical compat. reasons but it seems like it should be treated like a UI event for most purposes.Is there any chance of fixing this inconsistency at this point? It's not uncommon to use both events in a single library and this issue leads to incorrect behaviour with Shadow DOM.
The text was updated successfully, but these errors were encountered: