IMPR: Stop bubling on second click

This commit is contained in:
Tony Air 2023-10-23 05:39:55 +02:00
parent fe5ede2003
commit 03c6ca6332
1 changed files with 23 additions and 9 deletions

View File

@ -77,7 +77,14 @@ const DropdownHoverUI = ((window) => {
// nav second click
if (href && el.dataset.firstClick) {
console.log(`${NAME}: nav second click`)
e.stopImmediatePropagation()
if (typeof window.app === 'undefined' || typeof window.app.Router === 'undefined') {
window.location.href = href
return
}
window.app.Router.openURL(href)
}
el.dataset.firstClick = true
@ -85,7 +92,14 @@ const DropdownHoverUI = ((window) => {
// big screen click
if (href && window.innerWidth > 768 && parent.classList.contains('active-dropdown')) {
console.log(`${NAME}: big screen | nav click the dropdown is shown already`)
e.stopImmediatePropagation()
if (typeof window.app === 'undefined' || typeof window.app.Router === 'undefined') {
window.location.href = href
return
}
window.app.Router.openURL(href)
}
console.log(`${NAME}: nav toggle`)