Closed tunetheweb closed 4 months ago
Thanks for fixing this Barry! Lots of Target nulls due to CMP UI Click should go away with this change!
Don't get too excited just yet. I'm having dropping making this work in the general case. Not sure how it works on your site to be honest :-(
Don't get too excited just yet. I'm having dropping making this work in the general case. Not sure how it works on your site to be honest :-(
Thanks Barry, you know me well :)
I just did test out this change on few CMP scenarios and it seems work correctly, happy to test out more scenarios as well today.
@philipwalton with the latest change to keep the element, I think it makes sense to expose this as requested in #456 so I added that in https://github.com/GoogleChrome/web-vitals/pull/477/commits/663461df255f0a17f91cba26626e3d0654fb4f18. Technically another change to the API but as it's an addition I don't think we need another release candidate for this. WDYT?
Makes progress on #335
When a target element is removed from the DOM it cannot be looked up to get the CSS selector.
There are instances when the
first-input
andpointer-down
events provide a target element, but the laterpointerup
andclick
events do not as the element has been removed. This is even more apparent in v4 where we wait to attribute INP until idle.This PR saves a target reference for each event with an interaction id, so it can be retrieved later if the target is then null.
This will not help if the element is removed before the first event entry from that interactionId is reported so is not a full solution, but will help in some cases.