Skip to content

Commit

Permalink
fix(menu): avoid activating ancestors that without URL (#691)
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang authored Oct 8, 2024
1 parent 69215cf commit edd7b51
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion assets/hb/modules/header/js/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ import "js/bootstrap/src/offcanvas";
}

const isMenuParent = (parent) => {
const href = parent.getAttribute('href') ?? ''
const href = parent.getAttribute('href')
if (!href) {
return false
}

return window.location.href.indexOf(href) !== -1 || window.location.pathname.indexOf(href) !== -1
}

Expand Down

0 comments on commit edd7b51

Please sign in to comment.