Steps to reproduce
Expected results
- Page should be scrolled to External links and "External links" in the TOC should be bold and black.
Actual results
- The TOC momentarily focuses "External links" then switches to "Bibliography"
Environments observed
- Browser version: Microsoft Edge Version 111.0.1661.51
- OS version: MacOS Ventura
Check any additional observations
- Observed while not logged in (anonymous)
Developer notes
The code bolds the section that the hash fragment corresponds to until there is a scroll event. If there is a scroll event, the section that intersects with the scroll position is bolded.
When scrolled all the way to the bottom, any layout shift on the page — whether it's from a banner campaign or from something in the content that shifts — can trigger a scroll event that causes this issue.
In the "actual results" image, you can see that the "External Links" is bolded first (albeit briefly) followed by incorrectly bolding "Bibliography". The purple boxes are server rendered in an expanded state and then JS kicks in that collapses them. This causes a layout shift and scroll event that the code interprets as user initiated, so "External Links" is bolded because it corresponds to that scroll position.