A web performance API proposal to measure and report layout shifts (unexpected movement of page elements) as a Core Web Vital metric.
Layout Instability is a web platform API specification that defines how browsers should measure and report unexpected movement of visual elements on a webpage, known as layout shifts. It provides a standardized metric (Layout Shift Score) that quantifies visual instability, helping developers identify and fix issues that cause poor user experience. This metric is a key component of Google's Core Web Vitals, which assess real-world user experience on the web.
Web developers, performance engineers, and site reliability engineers who need to monitor and optimize the visual stability and user experience of their websites, particularly for Core Web Vitals compliance.
It provides a browser-native, standardized way to measure layout shifts—a critical user experience metric—directly integrated into the Performance API. Unlike synthetic monitoring tools, it captures real user experiences and offers detailed source attribution for debugging specific DOM elements causing shifts.
A proposal for a Layout Instability specification
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Integrates directly into the Performance API, providing a consistent, spec-driven way to measure layout shifts across compliant browsers, as highlighted in the overview and Performance API section.
Offers up to 5 LayoutShiftAttribution objects per shift, linking metrics to specific DOM nodes and their bounding rects for debugging, though this is currently limited to Chrome 84+ with experimental features enabled.
Automatically flags shifts within 500ms of user input via the hadRecentInput attribute, preventing penalties for intentional layout updates and reducing false positives, as explained in the Recent Input Exclusion section.
Designed to be implementable efficiently by browsers, with trade-offs allowed for performance, and provides cumulative scoring (DCLS/CLS) that aligns with Core Web Vitals for actionable insights.
The README explicitly states limitations, such as smooth animations scoring poorly or DOM rebuilds missing shifts, leading to potential inaccuracies in assessing actual visual jank.
Source attribution only identifies shifted elements, not underlying causes like inserted content, making debugging complex issues more challenging, as noted in the Causality caveat.
Implementation is inconsistent across browsers, with features like sources attribution only in Chrome, and the spec may evolve, risking developer reliance on unstable or varying outputs.
Developers must write custom code to compute cumulative scores like CLS, as these are not directly exposed by the API, adding complexity to integration and monitoring setups.