From 98f8823e0ad644f4ada100990aa02464708cb78d Mon Sep 17 00:00:00 2001 From: Mengci Cai Date: Thu, 19 Mar 2026 20:33:07 +0800 Subject: [PATCH] fix: improve menu interaction and notification center handling 1. Add keyboard grab when showing panel menus to ensure proper input focus 2. Release keyboard grab when closing menus to prevent input conflicts 3. Close notification center panel when opening various dock menus (dock menu, app context menu, tray popups) to avoid overlapping UI elements 4. Add focus handling for tray item popups to ensure proper keyboard navigation 5. Update copyright years for consistency Log: Fixed menu interactions by ensuring proper focus management and preventing overlapping with notification center Influence: 1. Test opening dock menu while notification center is open - notification center should close 2. Verify app context menus close notification center when opened 3. Check tray popups properly close notification center 4. Test keyboard navigation in all menu types 5. Verify input focus is correctly managed between menus and other UI elements 6. Test menu interactions with multiple open applications PMS: BUG-284867 --- frame/qml/PanelMenu.qml | 2 ++ panels/dock/tray/TrayItemSurfacePopup.qml | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/frame/qml/PanelMenu.qml b/frame/qml/PanelMenu.qml index a2104214c..ac9144715 100644 --- a/frame/qml/PanelMenu.qml +++ b/frame/qml/PanelMenu.qml @@ -62,6 +62,7 @@ Item { menuWindow.title = windowTitle menuWindow.show() DS.grabMouse(menuWindow) + DS.grabKeyboard(menuWindow) }) } @@ -75,6 +76,7 @@ Item { menuWindow.close() menuWindow.currentItem = null + DS.grabKeyboard(menuWindow, false) } Connections { diff --git a/panels/dock/tray/TrayItemSurfacePopup.qml b/panels/dock/tray/TrayItemSurfacePopup.qml index d2406a169..91be31765 100644 --- a/panels/dock/tray/TrayItemSurfacePopup.qml +++ b/panels/dock/tray/TrayItemSurfacePopup.qml @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024-2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -162,6 +162,8 @@ Item { return Qt.rect(point.x, point.y, popupMenu.width, popupMenu.height) }) popupMenu.open() + // TODO: 解决自定义右键菜单上下键无法切换的问题 + popupMenuContent.takeFocus() } } }