When people read long articles, technical documentation or detailed guides, they can easily lose their bearings or underestimate the effort needed to finish. An interactive reading index (a table of contents, or TOC) paired with a visual scroll progress bar noticeably improves the user experience, encouraging readers to finish and offering quick anchor points for jumping between sections.
This component uses a split layout: a side panel acting as the index and a main container for the text. Using JavaScript and the Intersection Observer API (or by watching the scroll event), the script detects which section is on screen and applies a state class (such as is-active) to the matching link in the index. At the same time, the horizontal progress bar at the top fills according to how far the text has been scrolled inside the container.
From an accessibility standpoint, the side index sits inside an <aside> tag with a descriptive aria-label="Guide index", letting screen readers identify it as a quick navigation area. The index links point to the internal anchors of the section headings through unique IDs. There is also an accessible "Back to top" button, which quickly returns the view to the start of the document — ideal for avoiding long manual scrolling, especially on mobile.