Skip to content

feat(query-builder): cancel condition mouse drag on Escape - #17768

Draft
ivanvpetrov wants to merge 2 commits into
ipetrov/drag-cancel-upon-escapefrom
ipetrov/qb-cancel-drag-upon-escape
Draft

ivanvpetrov wants to merge 2 commits into
ipetrov/drag-cancel-upon-escapefrom
ipetrov/qb-cancel-drag-upon-escape

Conversation

@ivanvpetrov

@ivanvpetrov ivanvpetrov commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Closes #17749

Depends on #17744.

Description

Pressing Escape while dragging a Query Builder condition with the mouse now cancels the drag. The condition stays where it was and is not dropped when the mouse button is released.

  • When a mouse drag starts, the dragged chip's dragDirective.cancelOnEscape is set to true (no new chip API).
  • onMoveEnd() receives the chip's moveEnd args and does not drop when originalEvent.cancelled is true.
  • During a mouse drag, Escape is no longer handled by the Query Builder's keyboard listener (the leftover TODO); the chip's igxDrag cancels the drag instead. Escape during a keyboard drag works as before.
  • Because igxDrag stops the Escape that cancels the drag, it doesn't also close a surrounding dialog (e.g. Advanced Filtering).

Related fix: if another condition's drag indicator gets focus during a mouse drag, that focus is ignored, which is correct. But once the mouse drag ended without a drop (cancelled with Escape, or released outside a drop area), Arrow Up/Arrow Down on that indicator still did nothing until it was focused again. Now a keyboard drag starts for the focused indicator when the mouse drag ends. The release-outside-a-drop-area case was already broken before this PR.

Motivation / Context

#17744 added cancelDrag() and cancelOnEscape to igxDrag. This PR uses them in the Query Builder, as described in #17749.

Type of Change (check all that apply):

  • Bug fix
  • New functionality
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring (no functional changes)
  • Documentation
  • Demos
  • CI/CD
  • Tests
  • Changelog
  • Skills/Agents

Component(s) / Area(s) Affected:

Query Builder (condition drag and drop)

How Has This Been Tested?

New and updated specs in query-builder.component.spec.ts, each failing before the change:

  • Escape during a mouse drag cancels it: moveEnd reports cancelled, the source condition is shown again, the expression tree is unchanged, and releasing the mouse afterwards doesn't drop.

  • cancelDrag() during a mouse drag doesn't drop.

  • A mouse drag after a cancelled one drops as usual.

  • After a mouse drag is cancelled with Escape, the drag indicator focused during it starts a keyboard drag with Arrow Up, and Space drops that condition.

  • After a mouse drag is released outside a drop area, the drag indicator focused during it starts a keyboard drag (extended the existing test).

  • Unit tests

  • Manual testing

  • Automated e2e tests

Test Configuration:

  • Angular version: 22.2.0
  • Browser(s): Chrome Headless 155
  • OS: Windows 11

Screenshots / Recordings

Checklist:

  • All relevant tags have been applied to this PR
  • This PR includes unit tests covering all the new code (test guidelines)
  • This PR includes API docs for newly added methods/properties (api docs guidelines)
  • This PR includes feature/README.MD updates for the feature docs
  • This PR includes general feature table updates in the root README.MD
  • This PR includes CHANGELOG.MD updates for newly added functionality
  • This PR contains breaking changes
  • This PR includes ng update migrations for the breaking changes (migrations guidelines)
  • This PR includes behavioral changes and the feature specification has been updated with them
  • Accessibility (ARIA, keyboard navigation, focus management) has been verified

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused implementation matches the stated requirements and includes comprehensive regression coverage.

0 open findings

What changed in this PR

Adds Escape cancellation for Query Builder condition mouse drags while preserving keyboard drag behavior and focus recovery.

Changes:

  • Enables cancelOnEscape and prevents cancelled drags from committing.
  • Restores keyboard dragging for indicators focused during an aborted mouse drag.
  • Adds regression tests and changelog entries.
File Description
query-builder.component.spec.ts Tests cancellation, subsequent drags, and focus recovery.
query-builder-tree.component.html Passes chip and move-end event data to the drag service.
query-builder-drag.service.ts Implements cancellation handling and keyboard-drag recovery.
CHANGELOG.md Documents the new behavior and related fix.

🧠 Review effort: Balanced


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@ivanvpetrov ivanvpetrov added the awaiting author When the reviewer/verifier has some confusions about the scenario/behavior and wait author's action label Oct 13, 2026
@ivanvpetrov
ivanvpetrov changed the base branch from ipetrov/qb-drag-base to ipetrov/drag-cancel-upon-escape October 19, 2026 07:42
@kdinev
kdinev force-pushed the ipetrov/drag-cancel-upon-escape branch from 456c723 to 9d0760f Compare October 19, 2026 07:59
@ivanvpetrov
ivanvpetrov force-pushed the ipetrov/qb-cancel-drag-upon-escape branch from 23b20e1 to 4dee85b Compare October 19, 2026 08:41
@ivanvpetrov
ivanvpetrov changed the base branch from ipetrov/drag-cancel-upon-escape to master October 19, 2026 08:50
@ivanvpetrov
ivanvpetrov changed the base branch from master to ipetrov/drag-cancel-upon-escape October 19, 2026 08:50
@ivanvpetrov
ivanvpetrov marked this pull request as ready for review October 19, 2026 08:50
@ivanvpetrov
ivanvpetrov marked this pull request as draft October 19, 2026 08:51

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting author When the reviewer/verifier has some confusions about the scenario/behavior and wait author's action drag-drop query-builder 🧰 feature-request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants