This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The lastInputTime read-only property of the LayoutShift interface returns the time of the most recent excluding input or 0 if no excluding input has occurred.
Layout shifts are only bad if the user wasn't expecting them. Layout shift metrics like CLS exclude shifts that occurred soon after certain user interactions. These interactions are called excluding inputs. Excluding inputs are:
mousedown, keydown, and pointerdown)change events.The mousemove and pointermove events are not excluding inputs.
A DOMHighResTimeStamp indicating the most recent excluding input time or 0 if no excluding input has occurred.
Log excluding input times if excluding input has occurred.
const observer = new PerformanceObserver((list) => {
list.getEntries().forEach((entry) => {
if (entry.lastInputTime) {
console.log(entry.lastInputTime);
}
});
});
observer.observe({ type: "layout-shift", buffered: true });
| Specification |
|---|
| Layout Instability API> # dom-layoutshift-lastinputtime> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
lastInputTime |
77 | 79 | No | 64 | No | 77 | No | 55 | No | 12.0 | 77 | No |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/LayoutShift/lastInputTime