Fixed #5054 - ContextMenu: Cache duplication "focusedItemId"

pull/5098/head
mertsincan 2024-01-15 00:05:19 +00:00
parent 261b6212f1
commit b843bc9de3
1 changed files with 7 additions and 7 deletions

View File

@ -10,9 +10,9 @@
:root="true"
:tabindex="tabindex"
aria-orientation="vertical"
:aria-activedescendant="focused ? focusedItemId : undefined"
:aria-activedescendant="focused ? focusedItemIdx : undefined"
:menuId="id"
:focusedItemId="focused ? focusedItemId : undefined"
:focusedItemId="focused ? focusedItemIdx : undefined"
:items="processedItems"
:templates="$slots"
:activeItemPath="activeItemPath"
@ -309,7 +309,7 @@ export default {
},
onEnterKey(event) {
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"]');
anchorElement ? anchorElement.click() : element && element.click();
@ -533,7 +533,7 @@ export default {
}
},
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}"]`);
if (element) {
@ -577,13 +577,13 @@ export default {
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;
}
},
components: {
ContextMenuSub: ContextMenuSub,
Portal: Portal
ContextMenuSub,
Portal
}
};
</script>