diff --git a/shell/plugins/bar/Bar.qml b/shell/plugins/bar/Bar.qml index 5c0daa46..5dcd205f 100644 --- a/shell/plugins/bar/Bar.qml +++ b/shell/plugins/bar/Bar.qml @@ -1417,6 +1417,9 @@ Item { } onPressAndHold: function(mouse) { + // A widget above us propagates its composed press-and-hold down here without + // ever handing over the grab, so we'd get no release or cancel to end the move. + if (!gestureArea.pressed) return startDrag(mouse.x, mouse.y) } diff --git a/test/shell.d/bar-test.sh b/test/shell.d/bar-test.sh index 7d52fc49..1443b8ed 100644 --- a/test/shell.d/bar-test.sh +++ b/test/shell.d/bar-test.sh @@ -14,6 +14,17 @@ if rg -q 'barMoveSettling|barMoveSettleTimer' "$ROOT/shell/plugins/bar/Bar.qml"; fi pass "bar move outline has no post-release settling state" +# A widget above the gesture area propagates its composed press-and-hold down +# without handing over the grab, so the resulting move gets neither a release +# nor a cancel and the ghost stays up for the session. Only the grabbing area +# reports pressed, which is what separates the two, so the guard has to stay +# ahead of the drag. +if ! perl -0ne 'exit(/onPressAndHold:\s*function[^{]*\{[^}]*?\bpressed\b[^}]*?\bstartDrag\b/s ? 0 : 1)' \ + "$ROOT/shell/plugins/bar/Bar.qml"; then + fail "bar move ignores a press-and-hold the gesture area does not hold the press for" +fi +pass "bar move ignores a press-and-hold propagated from a widget above" + run_node_test <<'JS' const fs = require('fs') const bar = requireFromRoot('shell/plugins/bar/BarModel.js')