-
Notifications
You must be signed in to change notification settings - Fork 391
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
Save INP target after interactions to reduce null values when removed from the DOM #477
Conversation
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.
Thanks for this change so quick.
Thanks for fixing this Barry! |
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 663461d. Technically another change to the API but as it's an addition I don't think we need another release candidate for this. WDYT? |
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.
@tunetheweb LGTM with a few changes from me (that we discussed offline). Feel free to merge if you're happy with my changes.
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.