Fixed #5054 - ContextMenu: Cache duplication "focusedItemId"
parent
261b6212f1
commit
b843bc9de3
|
@ -10,9 +10,9 @@
|
||||||
:root="true"
|
:root="true"
|
||||||
:tabindex="tabindex"
|
:tabindex="tabindex"
|
||||||
aria-orientation="vertical"
|
aria-orientation="vertical"
|
||||||
:aria-activedescendant="focused ? focusedItemId : undefined"
|
:aria-activedescendant="focused ? focusedItemIdx : undefined"
|
||||||
:menuId="id"
|
:menuId="id"
|
||||||
:focusedItemId="focused ? focusedItemId : undefined"
|
:focusedItemId="focused ? focusedItemIdx : undefined"
|
||||||
:items="processedItems"
|
:items="processedItems"
|
||||||
:templates="$slots"
|
:templates="$slots"
|
||||||
:activeItemPath="activeItemPath"
|
:activeItemPath="activeItemPath"
|
||||||
|
@ -309,7 +309,7 @@ export default {
|
||||||
},
|
},
|
||||||
onEnterKey(event) {
|
onEnterKey(event) {
|
||||||
if (this.focusedItemInfo.index !== -1) {
|
if (this.focusedItemInfo.index !== -1) {
|
||||||
const element = DomHandler.findSingle(this.list, `li[id="${`${this.focusedItemId}`}"]`);
|
const element = DomHandler.findSingle(this.list, `li[id="${`${this.focusedItemIdx}`}"]`);
|
||||||
const anchorElement = element && DomHandler.findSingle(element, 'a[data-pc-section="action"]');
|
const anchorElement = element && DomHandler.findSingle(element, 'a[data-pc-section="action"]');
|
||||||
|
|
||||||
anchorElement ? anchorElement.click() : element && element.click();
|
anchorElement ? anchorElement.click() : element && element.click();
|
||||||
|
@ -533,7 +533,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
scrollInView(index = -1) {
|
scrollInView(index = -1) {
|
||||||
const id = index !== -1 ? `${this.id}_${index}` : this.focusedItemId;
|
const id = index !== -1 ? `${this.id}_${index}` : this.focusedItemIdx;
|
||||||
const element = DomHandler.findSingle(this.list, `li[id="${id}"]`);
|
const element = DomHandler.findSingle(this.list, `li[id="${id}"]`);
|
||||||
|
|
||||||
if (element) {
|
if (element) {
|
||||||
|
@ -577,13 +577,13 @@ export default {
|
||||||
|
|
||||||
return processedItem ? processedItem.items : this.processedItems;
|
return processedItem ? processedItem.items : this.processedItems;
|
||||||
},
|
},
|
||||||
focusedItemId() {
|
focusedItemIdx() {
|
||||||
return this.focusedItemInfo.index !== -1 ? `${this.id}${ObjectUtils.isNotEmpty(this.focusedItemInfo.parentKey) ? '_' + this.focusedItemInfo.parentKey : ''}_${this.focusedItemInfo.index}` : null;
|
return this.focusedItemInfo.index !== -1 ? `${this.id}${ObjectUtils.isNotEmpty(this.focusedItemInfo.parentKey) ? '_' + this.focusedItemInfo.parentKey : ''}_${this.focusedItemInfo.index}` : null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
ContextMenuSub: ContextMenuSub,
|
ContextMenuSub,
|
||||||
Portal: Portal
|
Portal
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue