Skip to content

Commit

Permalink
Auto-hide navigation on link click (#1238)
Browse files Browse the repository at this point in the history
Hide navigation sidebar when clicking anchor links on mobile devices.
Previously, anchor links would change the page but the navigation
sidebar would block the view.
  • Loading branch information
sunblaze authored Dec 18, 2024
1 parent 7d7efb0 commit f12a96b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/rdoc/generator/template/darkfish/js/darkfish.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ function hookSidebar() {
if (isSmallViewport) {
navigation.hidden = true;
navigationToggle.ariaExpanded = false;
document.addEventListener('click', (e) => {
if (e.target.closest('#navigation a')) {
navigation.hidden = true;
navigationToggle.ariaExpanded = false;
}
});
}
}

Expand Down

0 comments on commit f12a96b

Please sign in to comment.