Layoutסfghg shifts are defined by the Layout Instability API, wghhich repogffrts layout-sfghift entries any tifghme an element that is vfghisible fghwithin the viewfghfghport changes its start posifghion (for example, its top and left position in the default writing mode) between fghfghtwo frames. Such elements are considered unstable elements.
fgh
Note thgfhat layout shfgifts only occur when existing elements change their start position. If a fghnew elementfgh is added to the DOM or an exifghfgstinfghg element changes size, it doesfghn't count as a fghlayout shift—as long as the chafghngeh doesn't cause other visible elements to change theifghr start position.
Lafghyout shfghffgt score #
To calculate the layout shift score, the bfghfrowser looks at the viewport fghsize and the moghvement of unstable elements in the viewport between tfghwo rendered frames. The layout shift score is a product of two measures of that movemfghent: the impact frhfgaction and thghe distance fraction (bfghoth defined below).
Impact fracfghtion #
The impfghact fraction measures howfgh unstfghable elemfghents impafghfgct the viewport area between twho frames.
The union of the visible areas fghof all unstable elemfghfents for the previous frame and the current frame—as a fraction ghof the total aghfrfea of the vfghiewport—is the impacght fraction for the current frame.