-
Notifications
You must be signed in to change notification settings - Fork 97
Open
Description
Bug Description
Clicking on sidebar navigation items causes the sidebar to scroll back to the top, making the selected item disappear from view. This disrupts user experience as users lose their position in the navigation.
Steps to Reproduce
- Navigate to documentation page (e.g., https://volcano.sh/en/docs/)
- Scroll down in the sidebar to view items below the fold
- Click on any sidebar item
- Observe: Sidebar scrolls to top, clicked item is no longer visible
Expected Behavior
The sidebar should maintain its scroll position after clicking an item, keeping the selected element in view.
Actual Behavior
Sidebar resets to top position on every navigation, forcing users to scroll again to find their location.
Root Cause
- Sidebar re-renders on page load without preserving scroll position
- JavaScript bug in
change()function: uses assignment (=) instead of comparison (==) - Loop condition
i <= ull.length +1causes array overflow
Affected Files
themes/academic/layouts/partials/docs_sidebar.html
Fix Applied
- Added
sessionStorageto preserve scroll position across page loads - Fixed comparison operator bug (
=→==) - Fixed loop bounds (
i <= ull.length +1→i < ull.length)
Environment
- Browser: All browsers
- Hugo Theme: Academic
- Occurs on both local development and production (volcano.sh)
Metadata
Metadata
Assignees
Labels
No labels