Page MenuHomePhabricator

[Bug] Sticky header doesn't show sometimes
Closed, ResolvedPublic2 Estimated Story PointsBUG REPORT

Description

There is a race condition that can prevent the sticky header from showing. It is especially prevalent on long pages, slow connections, and if the JS has been cached.

Steps to reproduce

  1. Throttle your internet connection using the "Network" tab in Chrome dev tools. Choose "Fast 3g" speed or slower:

Screen Shot 2022-02-09 at 4.15.19 PM.png (182×4 px, 105 KB)

  1. Login and visit https://en.wikipedia.org/wiki/Barack_Obama?useskin=vector-2022
  2. Scroll past the first heading

If the sticky header shows, refresh your browser and try again. The bug will only appear under certain conditions. Cached JS will make the bug more likely to surface.

Expected results

  • Sticky Header appears.

Actual results

  • Sticky Header does not appear.

Environments observed

  • Browser version: Chrome
  • OS version: Mac OS 11.6
  • Device model: MacBook Pro
  • Device language: en

Check any additional observations

Developer Notes

There is a DOM query for the #vector-sticky-header element that can execute before the DOM has finished loading. If the element is not found by the time this query executes, the sticky header will not show.

There is code that waits for the DOM to complete before calling the main method from the skins.vector.es6 module, but the code outside of this method (including the DOM query) will not be deferred.

Event Timeline

@nray I've tried as slow as 2G throttling and I'm still having some trouble reproducing this, do you have any tips on how to get this race condition to show?

@bwang For me, it happens nearly every time I use "Fast 3G" throttling on a long page like the Barack Obama page:

https://jumpshare.com/v/krxssDKgvIxP2Gcl8K3A

Long pages, slow connection, and cached JS will be the conditions most likely to reproduce it

Another thing you can do is put a console.log( document.readyState ); at the top of stickyHeader.js and see if it ever reports "loading" . If it does even once, it means this race condition is possible as the DOM has not finished loading by the time that has executed

@nray Oh oops I was using FF instead of Chrome, I see it now thanks!

Change 773341 had a related patch set uploaded (by Bernard Wang; author: Bernard Wang):

[mediawiki/skins/Vector@master] Move sticky header DOM queries into main.js

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

bwang removed bwang as the assignee of this task.Mar 24 2022, 5:38 PM
bwang moved this task from Doing to Code Review on the Web-Team-Backlog (Kanbanana-FY-2021-22) board.
bwang subscribed.

Change 773341 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Move sticky header DOM queries into main.js

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

Edtadros subscribed.

Test Result - Beta

Status:
Environment: beta
OS: macOS Monterey
Browser: Chrome
Device: MBP
Emulated Device:NA

Test Artifact(s):

QA Steps

Throttle your internet connection using the "Network" tab in Chrome dev tools. Choose "Fast 3g" speed or slower:
Login and visit https://en.wikipedia.org/wiki/Barack_Obama?useskin=vector-2022
Scroll past the first heading
❓ AC1: Sticky Header appears.
@nray, sometimes I get the sticky header to appear. It appears much faster in the Early life an career section, here are a few screen grabs.

Screen Recording 2022-04-04 at 4.04.51 PM 2.mov.gif (889×1 px, 3 MB)

Screen Recording 2022-04-04 at 4.00.33 PM.mov.gif (1×1 px, 2 MB)

Screen Recording 2022-04-04 at 4.06.35 PM.mov.gif (1×1 px, 2 MB)

I'm seeing the sticky header appear on beta cluster with Fast 3G and Slow 3g. This looks like a pass to me!

This looks like a pass in prod to me, I cant reproduce the original issue.

Screen Shot 2022-04-25 at 12.42.30 PM.png (996×3 px, 743 KB)

bwang removed bwang as the assignee of this task.Apr 25 2022, 5:55 PM

I am not sure if this is a new bug: whenever I scroll down on this page on dewiki, the sticky header seemingly gets confused by the intro. Starting from the very top, the header first shows when I reach the tabs. Then, in the middle of the first list of the intro (around the item requests for the attention of an administrator, it suddenly vanishes. Only when I reach the first regular section of the page, the header returns. When scrolling upwards, the header does not show at all once I'm above the first section. What is happening here, can others reproduce this (using Chrome, btw)?

@XanonymusX - thanks for reporting this. I can't seem to reproduce. Is there a chance you can take a screenshot/video of the behavior?

I can also reproduce it on this page, but not on eg this one. Thus it can’t just be the length of the introduction. Also happens in safemode. I made videos of the behaviour, but it seems I can’t upload them here …

EDIT: If I change the screen size, the behaviour sometimes happens and sometimes doesn't, I can't find any logic. The only thing that stays the same seems to be that the header always disappears in the lead section when scrolling up, I'm not sure if that is the desired behavior.