Skip to content

fix(drag-drop): disable drag on secondary pointer button - 21.2.x - #17523

Open
igdmdimitrov wants to merge 1 commit into
21.2.xfrom
dmdimitrov/fix-17424-21.2.x
Open

fix(drag-drop): disable drag on secondary pointer button - 21.2.x#17523
igdmdimitrov wants to merge 1 commit into
21.2.xfrom
dmdimitrov/fix-17424-21.2.x

Conversation

@igdmdimitrov

Copy link
Copy Markdown
Contributor

Closes #17424

Description

Modifying drag-drop directive to start drag only on primary mouse button

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 lite review requested due to automatic review settings August 24, 2026 15:31

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.

Pull request overview

This PR addresses issue #17424 by preventing the igxDrag directive from initiating drag interactions when the user presses a non-primary mouse/pointer button (e.g., right click), avoiding unintended drag/click behavior in components that rely on igxDrag (such as chips and grid row dragging).

Changes:

  • Added an early return in IgxDragDirective.onPointerDown to only start drag on the primary pointer/mouse button.
  • Added a unit test to ensure drag is not initiated on a secondary pointer button.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
projects/igniteui-angular/directives/src/directives/drag-drop/drag-drop.directive.ts Adds a guard to ignore non-primary button presses when starting a drag.
projects/igniteui-angular/directives/src/directives/drag-drop/drag-drop.spec.ts Adds a pointer-button test to validate the new behavior.

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

Comment on lines 2005 to +2006

it('should not initiate drag on secondary pointer button', async () => {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants