Skip to content

fix(drag-drop): keep the ghost under the pointer during window auto-scroll - #18026

Open
damyanpetev wants to merge 1 commit into
masterfrom
dpetev/drag-ghost-scroll-drift
Open

damyanpetev wants to merge 1 commit into
masterfrom
dpetev/drag-ghost-scroll-drift

Conversation

@damyanpetev

@damyanpetev damyanpetev commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #18024, extending its igxDrag window auto-scroll tests.

While igxDrag auto-scrolls the window with the pointer held still near the viewport edge, a ghost with a margin drifts away from the pointer. It moves up and left by its margin on every scroll step, so a ghost with margin: 10px is 50px off within a few steps. The next pointer move snaps it back.

Each scroll step moves the ghost with ghostTop += scrollByY. The ghostLeft/ghostTop setters take a page position that includes the margin and subtract it before writing style.left/style.top, but the getters returned the style value without adding it back. Every read-and-write cycle lost the margin.

The getters now add the margin back, so they return the position the setters take. This also changes location for a ghost with a margin. It now reports the same position setLocation() takes, consistent with location without a ghost. Before, it was off by the margin.

🤖 Generated with Claude Code

Base automatically changed from dpetev/vitest-coverage-tests to master November 23, 2026 11:49
…croll

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@damyanpetev
damyanpetev force-pushed the dpetev/drag-ghost-scroll-drift branch from 690f8c2 to 3b86c3c Compare November 25, 2026 15:33
Copilot AI balanced review requested due to automatic review settings November 25, 2026 15:33

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

No active review issues were identified for the drag-ghost auto-scroll positioning change.

No open issues 🎉

What changed in this PR

Fixes igxDrag ghost drift during window auto-scroll by making position getters include margins, matching the setters. Extends the auto-scroll coverage added in #18024.

Changes:

  • Keeps margin-bearing ghosts under a stationary pointer during auto-scroll and aligns location with setLocation().
  • Adds a regression test for stable ghost positioning, scrolling limits, and ghost cleanup on pointer release.
File Description
projects/​igniteui-angular/​directives/​src/​directives/​drag-drop/​drag-drop.spec.ts Adds regression coverage for ghost positioning during window auto-scroll.
projects/​igniteui-angular/​directives/​src/​directives/​drag-drop/​drag-drop.directive.ts Includes margins in ghost position getters to match setter coordinates.

Review effort: Balanced

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants