-
Notifications
You must be signed in to change notification settings - Fork 13
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
Consider expose interactionId to keypress, input, and more other event types #132
Comments
is this what i should follow to sort of add new APIs?
|
@zuoaoyuan what should i read before to implement, as there is a performanceEventtiming api and an interaction id which now supports only a few events where should i refer to learn more which can guide me to make the API for the evnts |
@Biki-das Glad to see you're interested on helping fix this issue.
Nice try but not what we need here:) The interactionId attribute we need to populate here is on performance observer entries (example). I assume you from GSoC and looking for projects? - if so, I would suggest as a first step, try copy & paste following js snippet into the console on any website and then interact on the page and see console logs printing, to get a feel on how event timing api works:)
And observer api spec could answer questions you have on the api itself. I don't expect GSoC students to understand more than that for now, but if you would like to learn more:
|
Thanks a lot @zuoaoyuan for the quick response,i will dig into this tomorrow and learn more about it and yes i came from the gsoc idealist page, this project is something that i see i can learn a lot from and understand indepth about browser events. Looking forward to continue the same with you :-) |
@zuoaoyuan I tried to play with the snippet that you shared, I have a few doubts while trying to understand it :
|
😅 Tried to just do a very tiny demonstration of what the key interactions state machine might look like
The state machine has four states: IDLE, KEY DOWN, KEY UP, and KEY REPEAT. Initially, the state machine is in the IDLE state. When a keydown event is detected, the state machine transitions to the KEY DOWN state. When a keyup event is detected, the state machine transitions to the KEY UP state. If another keydown event is detected while in the KEY DOWN state, the state machine transitions to the KEY REPEAT state. When a keyup event is detected while in the KEY REPEAT state, the state machine transitions back to the KEY DOWN state. As you said The first goal on this GSoC project would be to create a similar document for key interactions, what could possibly be the necessary information and research i can do meanwhile to think about creating the same |
@Biki-das Good work! I think the diagram you drew looks slightly different from what your comment described, but I understand the idea from your description. This looks like a nice first draft and we can iterate from it as our next step:
Note: Event Timing currently only assign interactionId to discrete interactions. That means, continuous interactions like scroll, drag & drop won't get an interactionId. Key press and hold is similar (in your case KEY REPEAT), but we chop it up and treat it as multiple discrete interactions. You can try on keyboard event viewer to learn how browser dispatch events from press & hold. Try on key event demo and check the 16ms checkbox to learn how event timing assign interactionId(that's no. in this demo) to entries result from key press & hold. SetKeyIdAndRecordLatency() is the current implementation on how event timing assign interactionId to keyboard related entries. Re your questions in the earlier comment:
Don't be scared at the moment, these investigations are all part of the GSoC project that we'll be going through together:) |
sorry for the late response, I am researching on the things you mentioned and making notes on the same , Thank you for extending such a smooth feedback for my queries :-) |
@zuoaoyuan as you said our next step would be to document the keyevent interactions as you have done for the pointer events how should i move on tbh, feeling quite overwhelmed with such a baggage of information found an interesting part in the w3c doc, Note: the algorithm attempts to assign events to the corresponding interactiond IDs. For keyboard events, a keydown triggers a new interaction ID, whereas a keyup has to match its ID with a previous keydown what would be the skills i would need to be able to atleast dive into this project, seems like i am missing something out? |
@Biki-das Glad to see you mastered mermaid to create the diagram so quick! Great work, and don't overwhelm yourself of course! The diagram can be iterated better as you learn more and understand better as the program go. Knowing C++ & JS would be fundamental skills, and if have experience with creating web pages, that would be a plus - helpful with testing the API changes. I don't think it's anything you're missing, it's just too much to learn in a few days. So don't overload yourself and give sometime to digest:) How's the code snippet go? Did you get |
@zuoaoyuan appreciate your encouragement, i am really diving deep to learn stuff as much as i can , so tried to play with the code snippet you shared and yeah have to say the event timing API seems tricky to work with, let me elaborate my observations
these were my observations and i might be wrong in ascertaining my observations, so looking upon your feeback, my first real and important goal is to understand this snippet well enough to move on to solve the next bigger problems :-) |
These all look expected to me.
|
Been a long catching this, what should be the next step, played with the API for a while now @zuoaoyuan , should i start documenting the key interaction state machine? |
@Biki-das That would a great next step in my opinion, its main purpose is to help you familiarize with key events. It can be either based on current implementation, or based on your ideal mental model. As you working on it, you'll learn from specs, get an idea on how keyboard interaction dispatch different events, understand how event timing process key events, and even discover problems with current implementation and come up with ideas on how we can expose interactionId to keypress and other events. All of above will be very helpful for you to write a great project proposal as well:) |
Hi @zuoaoyuan, I was researching project ideas suggested by organizations for GSOC 2023 and came across this idea. Thanks to the previous discussion on the post I was able to get some understanding of the idea, but I had a few things I'd like to discuss to be able to decide whether I'll be able to add meaningfull contributions to the project or not. Is there a list of specific events that we're currently targeting? I wanted to see if I can come up with a reasonable design of the state diagram for these events to get a better understanding of the required additions/changes to the logic.
I noticed that for handling
Isn't this true for having I was also skimming through the codebase to understand the already existing logic, and at line #335 it says that we ignore Also, the project doc mentioned in the GSOC info card seems to be private. Could this please be made public? Lastly, a few questions related to logistics :-
Apologies if this was a lot of text in a single comment. Looking forward to your reply! :) |
@daksh-goyal Thanks for your interest! W3C Event Timing Spec has listed events that we're currently targeting, except chromium expose to
Yes, and it currently does. See following screenshot captured from key event demo.
Not sure what change you're referring to here. Current implementation already handle multi-key user input, and each keydown keyup pair would be treated as a separate interaction. (Also demonstrated from above screenshot)
Indeed. And yes it would be ideal to expose to them as part of this project:) Regarding the project doc, unfortunately it was created by my google.com account so under company policy that I can't directly set it to public. Just request access, and I'll grant:) This project is suitable for only one contributor. High performance cloud machines will be granted based on previous experience, so hardwares will never be a hindrance for GSoC students:) |
Closing this ticket as completed since we've considered exposing interactionId and not seeing objections, also discussions under this thread has been kind of diverted.. Creating separate issues to track each specific task item:
|
Event timing has added interactionId attribute to all entries, but to most entry types, its value would be 0. Currently it's only exposed to [pointerdown, pointerup, click, keydown, keyup] with non-trivial values. But is this ideal?
I propose to expose interactionId to more entry types with following 3 reasons.
Pros:
INP reflect user experience more accurately
Entry with interactionId 0 could possibly be the potential INP candidate - have longest duration among all the entries from the same interaction, and having an interactionId 0 makes it not being counted towards INP and makes INP not reflecting the real user experience.
Keypress is one example and https://zuoaoyuan.github.io/key-event-demo/ demos it could have a longer duration than both keydown and keyup sometimes.
IME complications for keydown & keyup
IME behaves so differently on different platforms. For example, on Windows, it could output one keydown but two keyup from the same user input.
To tackle this problem, chromium is currently exposing interactionId to only input events when under composition. This is not ideal, but one step closer towards calculating INP. And we have plan to investigate exposing interactionId to more events under composition as well since only input event won't capture the longest duration either.
InteractionId of 0 confuse api users
We expect interactionId to uniquely identify events from the same user interaction. Since every entry is a direct/indirect result from an user input, ideally they should all have valid interactionIds. When there exist entries interactionId of 0, api users are unable to identify which interaction it belongs to solely from interactionId attribute, and usually user have to deduce that information from its timestamp and the order it comes in instead. This is bad.
The text was updated successfully, but these errors were encountered: