From fc07eee1b30b2aaec27f49f5b5de527ad5e8d037 Mon Sep 17 00:00:00 2001 From: Mengci Cai Date: Tue, 24 Mar 2026 14:29:07 +0800 Subject: [PATCH] feat: close other popups when opening context menus Added Panel.requestClosePopup() calls before opening context menus in both AppItem and tray components. This ensures that when a user opens a context menu (right-click menu), any other open popups are automatically closed to prevent multiple overlapping popups and maintain clean UI state. The change was necessary to improve user experience by avoiding visual clutter and potential interaction conflicts when multiple popups are open simultaneously. This follows standard UI patterns where opening a new context menu should dismiss other open popups. Log: Improved popup management - context menus now automatically close other open popups Influence: 1. Test right-clicking on app icons in task manager with other popups open 2. Verify tray icon context menus close existing popups 3. Check that normal popup functionality remains unaffected 4. Test with multiple popup scenarios to ensure proper dismissal 5. Verify no regression in menu opening/closing behavior PMS: BUG-284867 --- panels/dock/taskmanager/package/AppItem.qml | 1 + panels/dock/tray/TrayItemSurfacePopup.qml | 1 + 2 files changed, 2 insertions(+) diff --git a/panels/dock/taskmanager/package/AppItem.qml b/panels/dock/taskmanager/package/AppItem.qml index 40eed5b4e..b7b39aca3 100644 --- a/panels/dock/taskmanager/package/AppItem.qml +++ b/panels/dock/taskmanager/package/AppItem.qml @@ -428,6 +428,7 @@ Item { } function requestAppItemMenu() { + Panel.requestClosePopup() contextMenuLoader.trashEmpty = TaskManager.isTrashEmpty() contextMenuLoader.active = true MenuHelper.openMenu(contextMenuLoader.item) diff --git a/panels/dock/tray/TrayItemSurfacePopup.qml b/panels/dock/tray/TrayItemSurfacePopup.qml index 91be31765..c3cfbcdc2 100644 --- a/panels/dock/tray/TrayItemSurfacePopup.qml +++ b/panels/dock/tray/TrayItemSurfacePopup.qml @@ -161,6 +161,7 @@ Item { var point = Qt.point(popupMenu.shellSurface.x, popupMenu.shellSurface.y) return Qt.rect(point.x, point.y, popupMenu.width, popupMenu.height) }) + Panel.requestClosePopup() popupMenu.open() // TODO: 解决自定义右键菜单上下键无法切换的问题 popupMenuContent.takeFocus()