Skip to content

Commit

Permalink
fix(website): navigation page opening in section children
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Bogdanov <bbogdanov@vmware.com>
  • Loading branch information
bbogdanov committed Mar 10, 2022
1 parent fee9c1b commit a2606dd
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions apps/website/.vuepress/theme/components/Sidebar.vue
Expand Up @@ -27,7 +27,7 @@
>
<template v-for="(childItem, index) in $options.filters.filterReleasedComponents(item.children)">
<router-link
@focus.native="focusToggle(index)"
@focus.native="focusToggle(index, item.children)"
class="nav-link"
:to="childItem.path"
v-if="childItem.type !== 'external' && isBeta(childItem) === false"
Expand Down Expand Up @@ -195,14 +195,19 @@ export default {
// This is because Vue can't detect changes mutated on an array, so this alerts it of changes
this.$set(this.states, index, !this.states[index]);
},
focusToggle: function (index) {
focusToggle: function (index, items) {
if (this.states[index]) {
// already open
return;
} else {
// open when hidden item is focused
this.$set(this.states, index, !this.states[index]);
}
// Fix of https://github.com/vmware/clarity/issues/6757
if (this.states[index] !== items) {
return;
}
// open when hidden item is focused
this.$set(this.states, index, !this.states[index]);
},
isItemActive: function (childItem) {
const childItemPath = removePathExt(childItem.path);
Expand Down

0 comments on commit a2606dd

Please sign in to comment.