Skip to content

Commit f12a96b

Browse files
authored
Auto-hide navigation on link click (#1238)
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.
1 parent 7d7efb0 commit f12a96b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/rdoc/generator/template/darkfish/js/darkfish.js

+6
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ function hookSidebar() {
103103
if (isSmallViewport) {
104104
navigation.hidden = true;
105105
navigationToggle.ariaExpanded = false;
106+
document.addEventListener('click', (e) => {
107+
if (e.target.closest('#navigation a')) {
108+
navigation.hidden = true;
109+
navigationToggle.ariaExpanded = false;
110+
}
111+
});
106112
}
107113
}
108114

0 commit comments

Comments
 (0)