|
18 | 18 | <button class="button is-text cve-button-submenu-toggle" |
19 | 19 | @click="submenuObj.hasOwnProperty('items') && toggleSubmenuItem(`/${nav.path}/${submenuObj.path}`)" |
20 | 20 | :class="{'is-hidden': !submenuObj.hasOwnProperty('items')}" |
21 | | - :aria-expanded="selectedSubmenu.includes(`/${nav.path}/${submenuObj.path}`) ? 'true' : 'false'" |
| 21 | + :aria-expanded="isExpanded(submenuObj) ? 'true' : 'false'" |
22 | 22 | :aria-controls="submenuObj.id + 'nav'"> |
23 | 23 | <span class="icon cve-icon-xxs"> |
24 | | - <p :id="'navExpandCollapseAltText' + submenuObj.id" class="is-hidden"> |
25 | | - {{!selectedSubmenu.includes(`/${nav.path}/${submenuObj.path}`) ? 'collapse' : 'expand'}} |
26 | | - </p> |
27 | | - <font-awesome-icon class="icon" :icon="selectedSubmenu.includes(`/${nav.path}/${submenuObj.path}`) ? 'minus' : 'plus'" |
| 24 | + <font-awesome-icon class="icon" |
| 25 | + :icon="isExpanded(submenuObj) ? 'minus' : 'plus'" |
| 26 | + :title="isExpanded(submenuObj) ? 'collapse' : 'expand'" |
28 | 27 | aria-hidden="false" focusable="true" :aria-labelledby="'navExpandCollapseAltText' + submenuObj.id"/> |
29 | 28 | </span> |
30 | 29 | </button> |
31 | 30 | </span> |
32 | | - <ul v-if="selectedSubmenu.includes(`/${nav.path}/${submenuObj.path}`)" :id="submenuObj.id + 'nav'"> |
| 31 | + <ul v-if="isExpanded(submenuObj)" :id="submenuObj.id + 'nav'"> |
33 | 32 | <li v-for="(submenuItem, label) in submenuObj.items" :key="`${submenuObj.id}-${label}`"> |
34 | 33 | <router-link :class="isExactPath(`/${nav.path}/${submenuObj.path}#${submenuItem.anchorId}`) ? '' : 'cve-not-active-link'" |
35 | 34 | :to="`/${nav.path}/${submenuObj.path}#${submenuItem.anchorId}`" >{{ submenuItem.label }}</router-link> |
@@ -60,6 +59,9 @@ export default { |
60 | 59 | }; |
61 | 60 | }, |
62 | 61 | methods: { |
| 62 | + isExpanded(submenuObj) { |
| 63 | + return this.selectedSubmenu.includes(`/${this.nav.path}/${submenuObj.path}`); |
| 64 | + }, |
63 | 65 | toggleSubmenuItem(path) { |
64 | 66 | if (this.selectedSubmenu.includes(path)) { |
65 | 67 | const index = this.selectedSubmenu.indexOf(path); |
|
0 commit comments