Skip to content

bug(drag-drop): Item swapping behaviour not optimal for all scenarios #19249

Closed
@preda7or

Description

@preda7or

Reproduction

No special setup is needed, the "bug" can be reproduced even on the https://material.angular.io/cdk/drag-drop/overview site.

Expected Behavior

I expect an item to be swapped downwards if I drag another item towards its top (and the same for all directions).

(When using nested drop lists, I would even expect an item not to move till I get to the bottom of its nested drop list.)

Actual Behavior

Item's are swapped unrelated WHERE the cursor is over them,
and taking the mouse movement direction change into account in a way that is not always correct.

dnd

Environment

  • Angular: 9+
  • CDK/Material: 9.2.1
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): macOS

Suggestion

  1. Providing a sorting callback property for drop lists, so developers can handle custom sorting scenarios.
  2. Or making the built in sorting function more universal (even working with nested drop lists, without moving the parent item prematurely, etc.)

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: cdk/drag-drop

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions