From 2a512606d50a657af513b4306cc0ae858c912c85 Mon Sep 17 00:00:00 2001 From: tugcekucukoglu Date: Thu, 22 Feb 2024 15:58:31 +0300 Subject: [PATCH 1/2] Fixed #5316 - MenuBar: Pressing Escape-Key in submenu moves focus to first menuitem --- components/lib/menubar/Menubar.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/lib/menubar/Menubar.vue b/components/lib/menubar/Menubar.vue index b09e1f966..f796a896c 100755 --- a/components/lib/menubar/Menubar.vue +++ b/components/lib/menubar/Menubar.vue @@ -417,8 +417,12 @@ export default { this.onEnterKey(event); }, onEscapeKey(event) { - this.hide(event, true); - this.focusedItemInfo.index = this.findFirstFocusedItemIndex(); + if (this.focusedItemInfo.level !== 0) { + const _focusedItemInfo = this.focusedItemInfo; + + this.hide(event, false); + this.focusedItemInfo = { index: Number(_focusedItemInfo.parentKey[0]), level: 0, parentKey: '' }; + } event.preventDefault(); }, From 3cc37ba97919681ecac08f6b661a0d01ca4014ab Mon Sep 17 00:00:00 2001 From: tugcekucukoglu Date: Fri, 23 Feb 2024 15:34:18 +0300 Subject: [PATCH 2/2] Refactor #5316 --- components/lib/menubar/Menubar.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/lib/menubar/Menubar.vue b/components/lib/menubar/Menubar.vue index f796a896c..67e845a25 100755 --- a/components/lib/menubar/Menubar.vue +++ b/components/lib/menubar/Menubar.vue @@ -421,7 +421,7 @@ export default { const _focusedItemInfo = this.focusedItemInfo; this.hide(event, false); - this.focusedItemInfo = { index: Number(_focusedItemInfo.parentKey[0]), level: 0, parentKey: '' }; + this.focusedItemInfo = { index: Number(_focusedItemInfo.parentKey.split('_')[0]), level: 0, parentKey: '' }; } event.preventDefault();