Skip to content

feat: close other popups when opening context menus#1524

Merged
18202781743 merged 1 commit intolinuxdeepin:masterfrom
qxp930712:master
Mar 24, 2026
Merged

feat: close other popups when opening context menus#1524
18202781743 merged 1 commit intolinuxdeepin:masterfrom
qxp930712:master

Conversation

@qxp930712
Copy link

@qxp930712 qxp930712 commented Mar 24, 2026

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

Summary by Sourcery

Bug Fixes:

  • Prevent multiple overlapping popups by closing existing popups when opening task manager app item or tray context menus.

@sourcery-ai
Copy link

sourcery-ai bot commented Mar 24, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds calls to close any existing popups right before opening task manager app-item and tray-item context menus, ensuring only one popup is visible at a time and reducing UI clutter.

Sequence diagram for updated popup handling when opening context menus

sequenceDiagram
    actor User
    participant AppItem
    participant TrayItem
    participant Panel
    participant ContextMenu

    rect rgb(230,230,255)
        User->>AppItem: right_click_app_icon()
        AppItem->>Panel: requestClosePopup()
        Panel-->>AppItem: popupsClosed()
        AppItem->>ContextMenu: contextMenuLoader.active = true
        AppItem->>ContextMenu: MenuHelper.openMenu(item)
        ContextMenu-->>User: app_item_context_menu_visible
    end

    rect rgb(230,255,230)
        User->>TrayItem: right_click_tray_icon()
        TrayItem->>ContextMenu: popupMenu.open()
        ContextMenu-->>TrayItem: popup_opened
        TrayItem->>Panel: requestClosePopup()
        Panel-->>TrayItem: other_popups_closed()
        TrayItem->>ContextMenu: popupMenuContent.takeFocus()
        ContextMenu-->>User: tray_item_context_menu_focused
    end
Loading

File-Level Changes

Change Details Files
Ensure task manager app-item context menu closes other popups before opening.
  • Invoke popup close request at the start of the app item context menu opening function.
  • Preserve existing context menu configuration (trashEmpty flag) and opening logic.
panels/dock/taskmanager/package/AppItem.qml
Ensure tray item context menu closes other popups when opened from the tray surface popup.
  • Request closing other popups immediately after programmatically opening the tray popup menu.
  • Retain existing focus handling and geometry setup for the tray popup menu.
panels/dock/tray/TrayItemSurfacePopup.qml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The two call sites are inconsistent in ordering Panel.requestClosePopup() relative to opening the menu; consider calling it before popupMenu.open() in TrayItemSurfacePopup.qml (as in AppItem.qml) to avoid the new menu being immediately closed and to keep behavior consistent.
  • If this pattern of closing other popups before showing a context menu is needed in more than these two places, consider extracting a small helper (e.g., openContextMenuWithPopupClose(...)) to centralize the behavior and reduce the chance of future call sites forgetting Panel.requestClosePopup().
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The two call sites are inconsistent in ordering `Panel.requestClosePopup()` relative to opening the menu; consider calling it before `popupMenu.open()` in `TrayItemSurfacePopup.qml` (as in `AppItem.qml`) to avoid the new menu being immediately closed and to keep behavior consistent.
- If this pattern of closing other popups before showing a context menu is needed in more than these two places, consider extracting a small helper (e.g., `openContextMenuWithPopupClose(...)`) to centralize the behavior and reduce the chance of future call sites forgetting `Panel.requestClosePopup()`.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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
@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, qxp930712

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@18202781743 18202781743 merged commit 33421d8 into linuxdeepin:master Mar 24, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants