|
12 | 12 | :aria-expanded="isItemGroup(processedItem) ? isItemActive(processedItem) : undefined"
|
13 | 13 | :aria-haspopup="isItemGroup(processedItem) && !getItemProp(processedItem, 'to') ? 'menu' : undefined"
|
14 | 14 | :aria-level="level + 1"
|
15 |
| - :aria-setsize="getAriaSetSize()" |
| 15 | + :aria-setsize="getAriaSetSize" |
16 | 16 | :aria-posinset="getAriaPosInset(index)"
|
17 | 17 | v-bind="getPTOptions(processedItem, index, 'item')"
|
18 | 18 | :data-p-active="isItemActive(processedItem)"
|
@@ -123,6 +123,7 @@ export default {
|
123 | 123 | }
|
124 | 124 | },
|
125 | 125 | list: null,
|
| 126 | +
|
126 | 127 | methods: {
|
127 | 128 | getItemId(processedItem) {
|
128 | 129 | return `${this.menuId}_${processedItem.key}`;
|
@@ -176,11 +177,8 @@ export default {
|
176 | 177 | onItemMouseMove(event, processedItem) {
|
177 | 178 | this.$emit('item-mousemove', { originalEvent: event, processedItem });
|
178 | 179 | },
|
179 |
| - getAriaSetSize() { |
180 |
| - return this.items.filter((processedItem) => this.isItemVisible(processedItem) && !this.getItemProp(processedItem, 'separator')).length; |
181 |
| - }, |
182 | 180 | getAriaPosInset(index) {
|
183 |
| - return index - this.items.slice(0, index).filter((processedItem) => this.isItemVisible(processedItem) && this.getItemProp(processedItem, 'separator')).length + 1; |
| 181 | + return index - this.ariaPosInsetCompute.slice(0, index).length + 1; |
184 | 182 | },
|
185 | 183 | getMenuItemProps(processedItem, index) {
|
186 | 184 | return {
|
@@ -213,6 +211,14 @@ export default {
|
213 | 211 | };
|
214 | 212 | }
|
215 | 213 | },
|
| 214 | + computed: { |
| 215 | + ariaPosInsetCompute() { |
| 216 | + return this.items.filter((processedItem) => this.isItemVisible(processedItem) && this.getItemProp(processedItem, 'separator')); |
| 217 | + }, |
| 218 | + getAriaSetSize() { |
| 219 | + return this.items.filter((processedItem) => this.isItemVisible(processedItem) && !this.getItemProp(processedItem, 'separator')).length; |
| 220 | + } |
| 221 | + }, |
216 | 222 | components: {
|
217 | 223 | AngleRightIcon: AngleRightIcon,
|
218 | 224 | AngleDownIcon: AngleDownIcon
|
|
0 commit comments