Open npm1 opened 3 years ago
Agreed, or better yet, define various user interactions and the chain of events that follow from those interactions in one place (section), separate from the event API definitions. Then the order of events would be well-defined from those definitions, and the requirements saying "event X must be before event Y but after event Z" can be removed.
Also see #361
FYI: keydown
and keyup
may not be fired as a pair if it's consumed by OS/IME or active application is changed (e.g., Alt
+ Tab
on Windows). And also when active document is changed by the browser itself.
Currently we're attempting to specify interactionId in Event Timing: https://github.com/WICG/event-timing/pull/102.
It would be helpful if we could have a way to easily talk about groups of events that are associated because they correspond to some user interaction. In particular, we are interested in the following user interactions:
keydown
,keypress
, andkeyup
. We care mostly about being able to groupkeydown
andkeyup
as corresponding to the same physical key. I think this case is relatively simple: thecode
attribute values would be the same for such events. But obviously we don't want to group all keys with the samecode
in one group, but instead group thekeydown
either by itself or with the subsequentkeyup
, assuming there is nokeydown
with the samecode
in between the two.pointerdown
,touchstart
,pointerup
,touchend
,mousedown
,mouseup
, andclick
caused by either a tap/click or a drag on the website. I think this is tricky for a couple of reasons. First, we do not want to include scrolls, which can trigger some of these events, likepointerdown
. Second, I'm not quite sure if there is some analogue tocode
that uniquely identifies the physical trigger for all of those events. I know that MouseEvents have abutton
and PointerEvents have apointerId
, but can they be compared? We can probably ignore the touch events, and at the very minimum we want to group at leastpointerdown
,pointerup
, andclick
, and as they are all PointerEvents then we can group them bypointerId
. This similarly requires some logic to group only events that correspond to the same tap/drag together instead of just all events with the samepointerId
.Anyways, let me know if this makes sense and whether this is something you think could belong in this specification! I guess the second one might not since PointerEvents are in a separate spec?