Skip to content

Commit

Permalink
Fix version picker for old articles (#219)
Browse files Browse the repository at this point in the history
Fixes the bug with the product picker not working when you go below e.g.
IMDG 3.11
  • Loading branch information
fantkolja authored Jul 23, 2024
1 parent b303f98 commit f0bd546
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Binary file modified build/ui-bundle.zip
Binary file not shown.
18 changes: 11 additions & 7 deletions src/js/01-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@
}
}

function addVersionPickerEventListeners () {
document.getElementById('navbarProductName').addEventListener('click', versionPickerToggleHandler)

const navbarProductVersionEl = document.getElementById('navbarProductVersion')
if (navbarProductVersionEl) {
navbarProductVersionEl.addEventListener('click', versionPickerToggleHandler)
}
}

if (document.getElementsByClassName('nav-container').length > 0) {
var navContainer = document.querySelector('.nav-container')
var navToggle = document.querySelector('.nav-toggle')
Expand All @@ -22,6 +31,8 @@
// NOTE don't let click events propagate outside of nav container
navContainer.addEventListener('click', concealEvent)

addVersionPickerEventListeners()

var menuPanel = navContainer.querySelector('[data-panel=menu]')
if (!menuPanel) return
var nav = navContainer.querySelector('.nav')
Expand Down Expand Up @@ -55,13 +66,6 @@
}
})

document.getElementById('navbarProductName').addEventListener('click', versionPickerToggleHandler)

const navbarProductVersionEl = document.getElementById('navbarProductVersion')
if (navbarProductVersionEl) {
navbarProductVersionEl.addEventListener('click', versionPickerToggleHandler)
}

// NOTE prevent text from being selected by double click
menuPanel.addEventListener('mousedown', function (e) {
if (e.detail > 1) e.preventDefault()
Expand Down

0 comments on commit f0bd546

Please sign in to comment.