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
Pick the first non-null target for INP attribution #421
Conversation
Co-authored-by: Barry Pollard <barrypollard@google.com>
Co-authored-by: Barry Pollard <barrypollard@google.com>
@mmocny can you review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a strict improvement, thanks Rick.
This PR is similar to the strategy I've been advertising for measuring interaction targets. -- There is also a different strategy that works around the other problem with event targets... that they can be removed and GC-ed by the time Event Timing is reported. That gist is very rough, but gives you the idea: manage a map of event type + timestamp to whatever metadata you want, saved during event dispatch, then look it up from Event Timing. |
Co-authored-by: Philip Walton <philipwalton@users.noreply.github.com>
I added a test to cover the logic Rick added. It fails when run against |
Some pointer entries have a known bug causing them to have null event targets. In cases where there are mouse or click entries in the same interaction that do have non-null event targets, always prefer those.
This PR works around the bug by changing the
eventTarget
in INP attribution to use the first entry in the list having a non-null target, rather than always using the longest entry in the list, which may sometimes be a pointer entry.