Steps to reproduce
- Login and visit https://en.wikipedia.org/w/index.php?title=Dog&diff=prev&oldid=1136163079
- Scroll halfway down the page
- The TOC has 30px of space between its top and the top of the viewport
- 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)
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).