Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions panels/dock/taskmanager/package/AppItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ Item {
property bool enableTitle: false
property bool titleActive: enableTitle && titleLoader.active
property bool preservePanelPopupOnContextMenu: false
property var contextMenuGuard: null
property bool updateIconGeometry: true
property Item previewAnchor: icon
// Folder content replaces the overflow popup, so anchor it to the dock.
Expand Down Expand Up @@ -504,6 +505,10 @@ Item {
property bool trashEmpty: true
sourceComponent: LP.Menu {
id: contextMenu
onAboutToHide: Qt.callLater(function() {
if (MenuHelper.activeMenu === null && root.contextMenuGuard)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Overflow popup stays open

When another menu replaces an overflow app's context menu before the deferred hide callback runs, the deferred onAboutToHide handler sees a non-null MenuHelper.activeMenu and skips clearing the guard. The replacement menu has no handler to clear it when it closes, so the overflow popup stays open when the user clicks away.

Ensure the guard is cleared when the replacement menu closes instead of skipping the reset while MenuHelper.activeMenu is non-null.

Also at panels/dock/taskmanager/package/TaskOverflowButton.qml:228.

Prompt for AI agents
In `panels/dock/taskmanager/package/AppItem.qml` at line 509:

**Overflow popup stays open**

When another menu replaces an overflow app's context menu before the deferred hide callback runs, the deferred `onAboutToHide` handler sees a non-null `MenuHelper.activeMenu` and skips clearing the guard. The replacement menu has no handler to clear it when it closes, so the overflow popup stays open when the user clicks away.

Ensure the guard is cleared when the replacement menu closes instead of skipping the reset while `MenuHelper.activeMenu` is non-null.

Also at `panels/dock/taskmanager/package/TaskOverflowButton.qml:228`.

root.contextMenuGuard(false)
})
Instantiator {
id: menuItemInstantiator
model: JSON.parse(menus)
Expand Down Expand Up @@ -596,6 +601,8 @@ Item {
}

function requestAppItemMenu() {
if (root.contextMenuGuard)
root.contextMenuGuard(true)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Overflow popup stays open

When a folder in the overflow popup opens its context menu, requestAppItemMenu() sets the guard before opening the folder menu, but that menu does not use contextMenuLoader's hide handler. The guard remains active after the folder menu closes, so closeOnInactive stays false and the overflow popup does not close when the user clicks away.

Clear the guard when the folder context menu hides.

Also at panels/dock/taskmanager/package/AppItem.qml:508-511, panels/dock/taskmanager/package/AppItem.qml:604.

Prompt for AI agents
In `panels/dock/taskmanager/package/AppItem.qml` at line 605:

**Overflow popup stays open**

When a folder in the overflow popup opens its context menu, `requestAppItemMenu()` sets the guard before opening the folder menu, but that menu does not use `contextMenuLoader`'s hide handler. The guard remains active after the folder menu closes, so `closeOnInactive` stays false and the overflow popup does not close when the user clicks away.

Clear the guard when the folder context menu hides.

Also at `panels/dock/taskmanager/package/AppItem.qml:508-511`, `panels/dock/taskmanager/package/AppItem.qml:604`.

if (!root.preservePanelPopupOnContextMenu) {
Panel.requestClosePopup()
}
Expand Down
9 changes: 8 additions & 1 deletion panels/dock/taskmanager/package/TaskOverflowButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Item {
readonly property int popupColumns: Math.min(6, Math.max(1, overflowCount),
Math.max(1, Math.floor((popupAvailableWidth - 20) / popupCellWidth)))
property point popupAnchorPoint: Qt.point(0, 0)
property bool contextMenuActive: false

visible: overflowCount > 0 && overflow.buttonExtent > 0
x: root.taskManagerItem.useColumnLayout ? 0 : root.buttonOffset
Expand Down Expand Up @@ -136,6 +137,10 @@ Item {
overflowPopup.open()
}

function guardContextMenu(active) {
contextMenuActive = active
}

AppItemBackground {
width: root.hoverBackgroundWidth
height: root.hoverBackgroundHeight
Expand Down Expand Up @@ -220,7 +225,8 @@ Item {
contentReady: popupContentLoader.status === Loader.Ready
popupX: DockPanelPositioner.x
popupY: DockPanelPositioner.y
closeOnInactive: MenuHelper.activeMenu === null && !Panel.contextDragging
closeOnInactive: !root.contextMenuActive
&& MenuHelper.activeMenu === null && !Panel.contextDragging

Component.onCompleted: {
DockPanelPositioner.bounding = Qt.binding(function () {
Expand Down Expand Up @@ -299,6 +305,7 @@ Item {
title: popupDelegate.entry.title
enableTitle: false
preservePanelPopupOnContextMenu: true
contextMenuGuard: root.guardContextMenu
previewAnchor: overflowPopupContent
folderAnchor: root
updateIconGeometry: false
Expand Down
Loading