From b843bc9de3eb7665027bb521bbd596ffded99806 Mon Sep 17 00:00:00 2001 From: mertsincan Date: Mon, 15 Jan 2024 00:05:19 +0000 Subject: [PATCH] Fixed #5054 - ContextMenu: Cache duplication "focusedItemId" --- components/lib/contextmenu/ContextMenu.vue | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/components/lib/contextmenu/ContextMenu.vue b/components/lib/contextmenu/ContextMenu.vue index e07fc4d6c..7ed03f0a3 100755 --- a/components/lib/contextmenu/ContextMenu.vue +++ b/components/lib/contextmenu/ContextMenu.vue @@ -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 } };