Summary
Long documentation pages require users to manually scroll back to the top,
which is a poor UX — especially on API reference pages with many DocSection entries.
Proposed Solution
Add a fixed "scroll to top" button that:
- Appears in the bottom-right corner after the user scrolls down 300px
- Smoothly scrolls back to the top on click
- Adapts to light and dark mode using existing CSS variables
- Is injected globally via Docusaurus's
Root theme swizzle so it works on all doc pages
Implementation
- New component:
src/components/ScrollToTopButton/
- Theme override:
src/theme/Root.js (Docusaurus Root swizzle pattern)
- No changes needed to individual page or layout components