Skip to content

Commit

Permalink
Merge pull request #129 from digitalnsw/fix-mega-nav
Browse files Browse the repository at this point in the history
fix: meganav menu add a check if active elem is nav link
  • Loading branch information
cdbenj authored Mar 11, 2021
2 parents db4f113 + ae0d05a commit 48a530e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/main-navigation/main-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,9 @@ class Navigation {
checkIfContainsFocus() {
const { linkParent } = this.whichSubNavLatest()
const focusWithin = linkParent.contains(document.activeElement)
if (!focusWithin) {
this.toggleSubnavDesktop(true)
const isNavLinkActive = document.activeElement.getAttribute('class').indexOf('nsw-navigation__link') > -1
if (!focusWithin && isNavLinkActive) {
this.toggleSubnavDesktop()
}
}

Expand Down

0 comments on commit 48a530e

Please sign in to comment.