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
- 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
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
- Observed on a production wiki
- Observed on Vector desktop skin
- Observed on MinervaNeue responsive skin
- Observed while logged in
- Observed while not logged in (anonymous)
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.