Skip to content

Commit 412c676

Browse files
Fix version selector in responsive design (#345)
When the nav is hidden by default at narrow page widths, you can view the nav by clicking an icon. When the nav is opened and visible you can click links in the nav to move between pages. However, the `onClick` events for the version selector do not work. I traced this to another event that was taking priority, which was that any click anywhere in the html triggered the nav to close. Anywhere except links to other pages, which always fire first. This PR modifies the showNav function so that the nav is hidden if you click outside the nav, but not in the nav. This means that the version selector can be used. Note that depending on the screen resolution it is not actually possible to click outside the nav, because the nav fills the display area. --------- Co-authored-by: Stefano Ottolenghi <stefano.ottolenghi@neo4j.com>
1 parent a8d69f2 commit 412c676

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/js/01-nav.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131

132132
function showNav (e) {
133133
if (navToggle.classList.contains('is-active')) return hideNav(e)
134-
var html = document.documentElement
134+
var html = document.documentElement.querySelector('main.article')
135135
html.classList.add('is-clipped--nav')
136136
navToggle.classList.add('is-active')
137137
navContainer.classList.add('is-active')

0 commit comments

Comments
 (0)