From 0c44e20402450ed6a21e002dafdd5044cb1d02b4 Mon Sep 17 00:00:00 2001 From: tugcekucukoglu Date: Wed, 3 Apr 2024 17:06:06 +0300 Subject: [PATCH] Fixed #5318 - Menu components: Hidden Menu-Item can still be activated (focused) on Keyboard-Navigation --- components/lib/contextmenu/ContextMenu.vue | 5 ++++- components/lib/megamenu/MegaMenu.vue | 5 ++++- components/lib/menubar/Menubar.vue | 5 ++++- components/lib/tieredmenu/TieredMenu.vue | 5 ++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/components/lib/contextmenu/ContextMenu.vue b/components/lib/contextmenu/ContextMenu.vue index f159f8f69..b066a0a6a 100755 --- a/components/lib/contextmenu/ContextMenu.vue +++ b/components/lib/contextmenu/ContextMenu.vue @@ -106,6 +106,9 @@ export default { isItemDisabled(item) { return this.getItemProp(item, 'disabled'); }, + isItemVisible(item) { + return this.getItemProp(item, 'visible') !== false; + }, isItemGroup(item) { return ObjectUtils.isNotEmpty(this.getItemProp(item, 'items')); }, @@ -459,7 +462,7 @@ export default { return this.isValidItem(processedItem) && this.getProccessedItemLabel(processedItem)?.toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase()); }, isValidItem(processedItem) { - return !!processedItem && !this.isItemDisabled(processedItem.item) && !this.isItemSeparator(processedItem.item); + return !!processedItem && !this.isItemDisabled(processedItem.item) && !this.isItemSeparator(processedItem.item) && this.isItemVisible(processedItem.item); }, isValidSelectedItem(processedItem) { return this.isValidItem(processedItem) && this.isSelected(processedItem); diff --git a/components/lib/megamenu/MegaMenu.vue b/components/lib/megamenu/MegaMenu.vue index 6f934efa9..a34d0d55c 100755 --- a/components/lib/megamenu/MegaMenu.vue +++ b/components/lib/megamenu/MegaMenu.vue @@ -119,6 +119,9 @@ export default { isItemDisabled(item) { return this.getItemProp(item, 'disabled'); }, + isItemVisible(item) { + return this.getItemProp(item, 'visible') !== false; + }, isItemGroup(item) { return ObjectUtils.isNotEmpty(this.getItemProp(item, 'items')); }, @@ -515,7 +518,7 @@ export default { return this.isValidItem(processedItem) && this.getProccessedItemLabel(processedItem)?.toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase()); }, isValidItem(processedItem) { - return !!processedItem && !this.isItemDisabled(processedItem.item) && !this.isItemSeparator(processedItem.item); + return !!processedItem && !this.isItemDisabled(processedItem.item) && !this.isItemSeparator(processedItem.item) && this.isItemVisible(processedItem.item); }, isValidSelectedItem(processedItem) { return this.isValidItem(processedItem) && this.isSelected(processedItem); diff --git a/components/lib/menubar/Menubar.vue b/components/lib/menubar/Menubar.vue index 67e845a25..92aa2e410 100755 --- a/components/lib/menubar/Menubar.vue +++ b/components/lib/menubar/Menubar.vue @@ -121,6 +121,9 @@ export default { isItemDisabled(item) { return this.getItemProp(item, 'disabled'); }, + isItemVisible(item) { + return this.getItemProp(item, 'visible') !== false; + }, isItemGroup(item) { return ObjectUtils.isNotEmpty(this.getItemProp(item, 'items')); }, @@ -500,7 +503,7 @@ export default { return this.isValidItem(processedItem) && this.getProccessedItemLabel(processedItem)?.toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase()); }, isValidItem(processedItem) { - return !!processedItem && !this.isItemDisabled(processedItem.item) && !this.isItemSeparator(processedItem.item); + return !!processedItem && !this.isItemDisabled(processedItem.item) && !this.isItemSeparator(processedItem.item) && this.isItemVisible(processedItem.item); }, isValidSelectedItem(processedItem) { return this.isValidItem(processedItem) && this.isSelected(processedItem); diff --git a/components/lib/tieredmenu/TieredMenu.vue b/components/lib/tieredmenu/TieredMenu.vue index 968809e7a..1b4cb52d1 100755 --- a/components/lib/tieredmenu/TieredMenu.vue +++ b/components/lib/tieredmenu/TieredMenu.vue @@ -115,6 +115,9 @@ export default { isItemDisabled(item) { return this.getItemProp(item, 'disabled'); }, + isItemVisible(item) { + return this.getItemProp(item, 'visible') !== false; + }, isItemGroup(item) { return ObjectUtils.isNotEmpty(this.getItemProp(item, 'items')); }, @@ -493,7 +496,7 @@ export default { return this.isValidItem(processedItem) && this.getProccessedItemLabel(processedItem)?.toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase()); }, isValidItem(processedItem) { - return !!processedItem && !this.isItemDisabled(processedItem.item) && !this.isItemSeparator(processedItem.item); + return !!processedItem && !this.isItemDisabled(processedItem.item) && !this.isItemSeparator(processedItem.item) && this.isItemVisible(processedItem.item); }, isValidSelectedItem(processedItem) { return this.isValidItem(processedItem) && this.isSelected(processedItem);