Page MenuHomePhabricator

Collect layout shift attribution information
Closed, ResolvedPublic

Description

We collect data from the Layout Instability API and attribution has recently been added to it. That information is available in Chrome 84+ https://www.chromestatus.com/feature/5712483207610368

Let's collect some of that information in order to get some insight about where layout shifts are coming from.

One caveat of this new "sources" attribute is that it lists elements affected by the shift, not elements causing the shift. Still, it should be enough information to figure out what is shifting.

Event Timeline

Example sources data as a result of a CentralNotice banner on frwiki:

Screenshot 2020-08-06 at 12.06.09.png (1,608×1,036 px, 309 KB)

Gilles renamed this task from Collect layout shift attribution information to [Q1 OKR] Collect layout shift attribution information.Aug 6 2020, 10:07 AM
Gilles renamed this task from [Q1 OKR] Collect layout shift attribution information to Collect layout shift attribution information.
Gilles triaged this task as Medium priority.

Change 618731 had a related patch set uploaded (by Gilles; owner: Gilles):
[mediawiki/extensions/NavigationTiming@master] Collect some attribution for layout shifts

https://gerrit.wikimedia.org/r/618731

Change 618731 merged by jenkins-bot:
[mediawiki/extensions/NavigationTiming@master] Collect some attribution for layout shifts

https://gerrit.wikimedia.org/r/618731

Now that the data is flowing in, here are the top 10 most frequent layout shift first nodes. I've tried to figure out where the shifts are coming from.

SelectorCountLikely source
h1#firstHeading.firstHeading131224CentralNotice banners
div.pre-content.heading-holder119961CentralNotice banners on mobile
table.infobox113968CentralNotice banners
div#right-navigation52023?
table.infobox.biography.vcard44174CentralNotice banners
div.thumbinner40233CentralNotice banners, for above-the-fold thumbnails?
div.mw-mmv-image-metadata-column.mw-mmv-image-metadata-links-column24739MediaViewer false positive from the drawer animation
div.mw-mmv-post-image.mw-mmv-ttf-ellipsis-container.invite23369MediaViewer false positive from the drawer animation
div.mw-mmv-about-links21278MediaViewer false positive from the drawer animation
nav#p-participate.vector-menu.vector-menu-portal.portal20840Language selection gadget on Commons
Screenshot 2020-09-21 at 09.36.57.png (282×124 px, 10 KB)

Digging deeper into div#right-navigation, I can't find any particular pattern (wiki, OS, authed, etc.). The fact that only Chromium has implemented this API makes it difficult to know if this is an issue on our end that only happens sometimes (CN banner-related ?) or if it's a browser bug.