Closed rviscomi closed 7 months ago
@mmocny can you review?
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.
I added a test to cover the logic Rick added. It fails when run against main
but passed when run on this branch.
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.