Skip to content

Commit

Permalink
fixing instances when global nav interferes with JumpNav header store
Browse files Browse the repository at this point in the history
  • Loading branch information
stephiescastle committed Aug 28, 2024
1 parent 5132dd5 commit aef735b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/vue/src/components/NavJumpMenu/NavJumpMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
ref="NavJumpMenuRef"
class="NavJumpMenu -hide-until-threshold"
:invert="invert"
jump-menu
>
<template v-for="(item, index) in theBreadcrumbs">
<template v-if="item.children && item.children.length > 0">
Expand Down
13 changes: 11 additions & 2 deletions packages/vue/src/components/NavSecondary/NavSecondary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ export default defineComponent({
type: Boolean,
required: false,
default: false
},
jumpMenu: {
type: Boolean,
default: false
}
},
data(): {
Expand All @@ -101,9 +105,12 @@ export default defineComponent({
if (this.breadcrumb) {
// we also want to update the store to override secondary nav
mixinUpdateSecondary(JSON.parse(this.breadcrumb))
return JSON.parse(this.breadcrumb)
} else if (this.headerStore) {
return this.headerStore.globalChildren
if (!this.jumpMenu) {
return this.headerStore.globalChildren
}
}
return undefined
},
Expand All @@ -117,7 +124,9 @@ export default defineComponent({
mounted() {
if (this.enabled) {
// if there is a secondary nav displayed, then don't highlight the primary active item
mixinHighlightPrimary(false)
if (!this.jumpMenu) {
mixinHighlightPrimary(false)
}
}
if (
Expand Down
2 changes: 1 addition & 1 deletion packages/vue/src/utils/mixins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export const mixinIsActivePath = (itemPath: string): Boolean => {
// special treatment since EDU combines News & Events in the main nav
return path.startsWith('/edu/news')
} else {
return currentPath.startsWith(path)
return currentPath.startsWith(ancestorPath)
}
}
return false
Expand Down

0 comments on commit aef735b

Please sign in to comment.