Steps to reproduce
- Login and visit https://en.wikipedia.org/w/index.php?title=Dog&diff=prev&oldid=1136163079
- Scroll halfway down the page
Expected results
- The TOC has 30px of space between its top and the top of the viewport
Actual results
- The TOC has ~93px of space between its top and the top of the viewport
Check any additional observations
- Observed on the beta cluster wiki
- Observed on a production wiki
- Observed on Vector 2022 desktop skin
- Observed on MinervaNeue responsive skin
- Observed while logged in
- Observed while not logged in (anonymous)
Developer Notes
The cause of this is also the cause of T300612 (which remains unresolved) and will also affect the sticky page tools when logged-in T318169. In each issue, we have JS that prevents showing the sticky header on certain pages/actions, but the vector-sticky-header-enabled CSS class responsible for adding extra space to account for the height of a sticky header remains on the html element.
The easiest solution is to make the JS remove the vector-sticky-header-enabled class if the namespace or action doesn't allow a sticky header. But this would result in a possible layout shift of the sticky elements (TOC, page tools, etc).
Therefore, the best solution in terms of user experience and performance is to move the client-side logic responsible for determining whether the sticky header should show to the back-end. If the page doesn't allow the sticky header, the vector-sticky-header-enabled class should not be added to the html element.