Skip to content

Commit aa5bee1

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 0aea703 commit aa5bee1

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
@@ -133,7 +133,7 @@
133133

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

0 commit comments

Comments
 (0)