-
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 exposing event target ID (for cases where target is detached) #126
Comments
As we're already doing something similar for Element Timing, this seems easy enough to both justify and add. I'd be curious to hear from @nhelfman if this would help tackle some of the use cases that he and his team have been running into. |
For my team it will help with identifying DOM elements which have not explicitally tracked user interaction. Typically this is not necessary since for each interaction we care about we keep a map of the event timestamp to correlate with the event timing entries and use a specific tagging label. When we process the events we collect event timing entries which we don't have a tracking in the map and aggregate them seperately as "untracked". To diffentiate between them we lookup the target DOM element For the cases the DOM element has been detached likely have a blindspot. |
Thanks for the feedback! I didn't realize that we do this for Element Timing, will take a look at that. |
Element Timing uses an attribute just named I am not sure if for Event Timing it should also just be (I also notice that the "get an element" algorithms are duplicated across specs and maybe could be refactored into performance timeline or something) |
Hello, We are working on a RUM based on the vitals web API and we noticed that our users (mainly retail) have the same concern. Namely the main contributors on the INP have the target field set to null. |
Thanks for the feedback! I was actually playing around with this recently and stumpled on I think that will become even more valuable to cross reference than just the target itself. |
After a bunch of iteration of feedback, we have decided to expose a very simple value:
This is easily actionable by a developer, and provides immediate value, without having to solve a bunch of issues. Element Timing already exposes Layout Instability API also exposes nodes, but doesn't expose any other information. |
Event Timing Entries report a
target
attribute, which runs the get an element algorithm.This will return
null
in cases where the element is detached from document at the time the getter is called. This is especially problematic in cases where an Interaction modies the DOM, removing the element that was just interacted with, and the Event Timing PerformanceObserver doesn't fire until later. In such cases, there is no window of opportunity to read metadata about the event target at all.The typical solution to this is to register an event handler and collect metadata about it during event dispatch -- but this has a potential performance cost during a critical moment of user experience.
We should consider capturing and exposing the event target id attribute to Event Timing Entries, which could persist even when the Node unavailable.
The text was updated successfully, but these errors were encountered: