bitovi / academy

Everything we know about frontend, backend, UX, and Devops consulting and management.
https://www.bitovi.com/academy/
14 stars 3 forks source link

Fix scrolling bug in Academy #840

Closed chasenlehara closed 2 months ago

chasenlehara commented 2 months ago

This fixes a bug where if you click something in the TOC and reload, then scroll somewhere else, you will be scrolled back to the anchor you clicked

This completely refactors how the header, sidebar, main content, and table of contents (TOC) are laid out.

Previously, JS was required to keep track of the scroll position on reload. This caused bugs (like the wrong position being restored on reload if you clicked a link in the TOC) and led to some features being lost (like the “tap to scroll to the top of the page” in Safari).

Now, the browser is able to keep track of the scroll position for the page, so no JS is required and the CSS layout is more robust.