Skip to content

fix(dock-tray): prevent stash popup from closing during drag-and-drop - #1685

Open
MyLeeJiEun wants to merge 1 commit into
linuxdeepin:masterfrom
MyLeeJiEun:fork-from-master-0730/bug-336185
Open

fix(dock-tray): prevent stash popup from closing during drag-and-drop#1685
MyLeeJiEun wants to merge 1 commit into
linuxdeepin:masterfrom
MyLeeJiEun:fork-from-master-0730/bug-336185

Conversation

@MyLeeJiEun

@MyLeeJiEun MyLeeJiEun commented Aug 3, 2026

Copy link
Copy Markdown
Contributor
  1. Added contextDragging check to keep the close timer from running during drag
  2. Track wasOpenBeforeDrag flag to distinguish user-initiated open from drag open
  3. Track stashDropSucceeded flag to prevent closing when drag successfully moves to stash
  4. Wired up onStashDropSucceeded callbacks from both StashContainer and TrayContainer

Log: Fix stash popup being unexpectedly closed during drag-and-drop operations
Influence: Resolves popup close behavior during drag

fix(dock-tray): 修复拖拽过程中 stash 面板意外关闭的问题

  1. 添加 contextDragging 检查,防止拖拽中关闭计时器运行
  2. 记录 wasOpenBeforeDrag 标记,区分用户主动打开和拖拽打开
  3. 记录 stashDropSucceeded 标记,防止拖拽成功移入 stash 后关闭面板
  4. 连接 StashContainer 和 TrayContainer 的拖拽成功回调

Log: 修复拖拽操作时 stash 面板被意外关闭的问题
PMS: BUG-336185
Influence: 解决拖拽时面板关闭行为异常

Summary by Sourcery

Adjust dock tray stash popup behavior to remain open and avoid unintended closure during drag-and-drop operations.

Bug Fixes:

  • Prevent stash popup from closing while a drag operation is in progress.
  • Ensure the stash popup stays open after a successful drag moving an item into the stash.
  • Preserve user-initiated stash popup visibility so it is not auto-closed after related drag actions.

Enhancements:

  • Add state tracking for drag context and stash drop success to coordinate popup open/close behavior between tray and stash containers.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry @MyLeeJiEun, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: MyLeeJiEun

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

@deepin-ci-robot

Copy link
Copy Markdown

Hi @MyLeeJiEun. Thanks for your PR.

I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@sourcery-ai

sourcery-ai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR refines the tray/stash popup’s drag-and-drop behavior by tracking drag context and drop success, and conditionally suppressing the auto-close timers so the stash panel stays open during valid drag operations while still closing correctly in other cases.

Sequence diagram for updated drag-and-drop stash popup behavior

sequenceDiagram
    actor User
    participant Panel
    participant TrayContainer
    participant StashContainer
    participant StashedPopup as stashedPopup
    participant CloseTimerTray as closeStashPopupTimerTray
    participant CloseTimerBtn as closeStashPopupTimerButton

    User->>Panel: start drag
    Panel->>Panel: contextDragging = true (onContextDraggingChanged)
    Panel->>StashedPopup: wasOpenBeforeDrag = popupVisible
    Panel->>StashedPopup: stashDropSucceeded = false
    Note over CloseTimerTray,CloseTimerBtn: Timers see Panel.contextDragging and do not run

    alt drop on stash button (TrayContainer)
        User->>TrayContainer: drop
        TrayContainer->>DDT.TraySortOrderModel: dropToDockTray(surfaceId, index, isBefore)
        DDT.TraySortOrderModel-->>TrayContainer: success
        TrayContainer->>TrayContainer: isDroppedOnStashButton = (SurfaceIdRole == internal/action-show-stash)
        TrayContainer-->>StashedPopup: onStashDropSucceeded()
        StashedPopup->>StashedPopup: stashDropSucceeded = true
    else drop into stash popup (StashContainer)
        User->>StashContainer: drop
        StashContainer->>DDT.TraySortOrderModel: dropToStashTray(surfaceId, 0, false)
        DDT.TraySortOrderModel-->>StashContainer: success
        StashContainer-->>StashedPopup: onStashDropSucceeded()
        StashedPopup->>StashedPopup: stashDropSucceeded = true
    end

    User->>Panel: end drag
    Panel->>Panel: contextDragging = false (onContextDraggingChanged)

    CloseTimerTray->>CloseTimerTray: running = !Panel.contextDragging
    CloseTimerBtn->>CloseTimerBtn: running = !Panel.contextDragging

    CloseTimerTray->>StashedPopup: onTriggered
    alt wasOpenBeforeDrag == false and stashDropSucceeded == false and !dropHover
        CloseTimerTray->>StashedPopup: close()
    end

    CloseTimerBtn->>StashedPopup: onTriggered
    alt wasOpenBeforeDrag == false and stashDropSucceeded == false
        CloseTimerBtn->>StashedPopup: close()
    end
Loading

File-Level Changes

Change Details Files
Track whether the stash popup was open before a drag starts and whether a drag successfully moved an item into the stash, and use these flags to gate auto-close logic.
  • Added wasOpenBeforeDrag and stashDropSucceeded properties on the stash popup state
  • Recorded wasOpenBeforeDrag and reset stashDropSucceeded on Panel.contextDragging changes
  • Updated timers so they never close the popup while a drag is in progress and only close when the popup was opened by the drag and the drop did not succeed
  • Marked wasOpenBeforeDrag on explicit user click to keep user-opened panels from auto-closing after drag
panels/dock/tray/package/tray.qml
panels/dock/tray/package/ActionShowStashDelegate.qml
Propagate stash drop success from both the tray and stash containers back to the popup so it can avoid closing after a successful move.
  • Introduced onStashDropSucceeded callback properties on TrayContainer and StashContainer and wired them from tray.qml
  • In TrayContainer, detected drops onto the stash button (action-show-stash) before mutating the model and invoked the callback only when the model drop succeeded
  • In StashContainer, invoked the callback only when dropToStashTray reported success and ensured stashItemDragging is cleared on drag exit
panels/dock/tray/package/TrayContainer.qml
panels/dock/tray/package/StashContainer.qml
panels/dock/tray/package/tray.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

@MyLeeJiEun
MyLeeJiEun force-pushed the fork-from-master-0730/bug-336185 branch from ed68d70 to ff8dd8a Compare August 3, 2026 06:04
1. Added contextDragging check to keep the close timer from running during drag
2. Track wasOpenBeforeDrag flag to distinguish user-initiated open from drag open
3. Track stashDropSucceeded flag to prevent closing when drag successfully moves to stash
4. Wired up onStashDropSucceeded callbacks from both StashContainer and TrayContainer

Log: Fix stash popup being unexpectedly closed during drag-and-drop operations
Influence: Resolves popup close behavior during drag

fix(dock-tray): 修复拖拽过程中 stash 面板意外关闭的问题

1. 添加 contextDragging 检查,防止拖拽中关闭计时器运行
2. 记录 wasOpenBeforeDrag 标记,区分用户主动打开和拖拽打开
3. 记录 stashDropSucceeded 标记,防止拖拽成功移入 stash 后关闭面板
4. 连接 StashContainer 和 TrayContainer 的拖拽成功回调

Log: 修复拖拽操作时 stash 面板被意外关闭的问题
PMS: BUG-336185
Influence: 解决拖拽时面板关闭行为异常
@MyLeeJiEun
MyLeeJiEun force-pushed the fork-from-master-0730/bug-336185 branch from ff8dd8a to 35bbf79 Compare August 3, 2026 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants