Skip to content

v4 INP attribution ending processingEnd time in the wrong animation frame #462

Open
@mmocny

Description

@mmocny

Screenshot:
Screenshot 2024-04-10 at 11 34 28

(notice that processing time ends after the paint/commit on main thread).

Note: I was using the experimental PR of Web Vitals Extension to test web-vitals.js v4 beta, but I didn't confirm that it has the latest and greatest version.


Example trace: https://trace.cafe/t/MUVKayAJwm

I think what miught be happening is that we are using the event renderTime as the end point and finding the last LoAF in that range, rather than using the event processing times? I'm not sure.

In order to reproduce here are the steps:

  • Visit this site on a desktop device with a physical mouse pointer.
  • Add a snippet of (see below)
  • Interact with the "Custom Metrics Data" <details> element
  • You should notice a Jank (long INP). In the middle of the jank, move your mouse around to hover over things.

Snippet:

const EVENTS = [
  "keydown",
  "keyup",
  "keypress",
//   "pointerdown",
//   "pointerup",
  "pointercancel",
  "touchstart",
  "touchend",
  "touchcancel",
//   "mousedown",
//   "mouseup",
  "gotpointercapture",
  "lostpointercapture",
//   "click",
  "dblclick",
  "auxclick",
  "contextmenu",
  "pointerleave",
  "pointerout",
  "pointerover",
  "pointerenter",
  "mouseout",
  "mouseover",
  "mouseleave",
  "mouseenter",
  "lostpointercapture",
  "dragstart",
  "dragend",
  "dragenter",
  "dragleave",
  "dragover",
  "drop",
  "beforeinput",
  "input",
  "compositionstart",
  "compositionupdate",
  "compositionend",
];

function block(ms) {
	const target = performance.now() + ms;
	while(performance.now() < target);
}

EVENTS.forEach(type => {
	document.addEventListener(type, e => {
		console.log(`Event type: ${type}`);
		block(20);
	});
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions