Skip to content
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

Define groups of events by the interaction that caused them #311

Open
npm1 opened this issue Sep 9, 2021 · 2 comments
Open

Define groups of events by the interaction that caused them #311

npm1 opened this issue Sep 9, 2021 · 2 comments

Comments

@npm1
Copy link

npm1 commented Sep 9, 2021

Currently we're attempting to specify interactionId in Event Timing: w3c/event-timing#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:

  • Pressing (and potentially releasing) a key. This would cause at least keydown, keypress, and keyup. We care mostly about being able to group keydown and keyup as corresponding to the same physical key. I think this case is relatively simple: the code attribute values would be the same for such events. But obviously we don't want to group all keys with the same code in one group, but instead group the keydown either by itself or with the subsequent keyup, assuming there is no keydown with the same code in between the two.
  • Taps and drags: this seems a bit trickier. We want to group pointerdown, touchstart, pointerup, touchend, mousedown, mouseup, and click 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, like pointerdown. Second, I'm not quite sure if there is some analogue to code that uniquely identifies the physical trigger for all of those events. I know that MouseEvents have a button and PointerEvents have a pointerId, but can they be compared? We can probably ignore the touch events, and at the very minimum we want to group at least pointerdown, pointerup, and click, and as they are all PointerEvents then we can group them by pointerId. This similarly requires some logic to group only events that correspond to the same tap/drag together instead of just all events with the same pointerId.

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?

@zcorpan
Copy link
Member

zcorpan commented Jan 11, 2024

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

@masayuki-nakano
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants