Skip to content

Emit Drop Target Index Change #13863

Closed
@techy2493

Description

@techy2493

Bug, feature request, or proposal:

Feature Request

What is the expected behavior?

When a user drags a cdkDrag around in a cdkDropList container, and the index it will dropped into changes emit an event with the new drop target index.

What is the current behavior?

No event is emitted, you must wait for the user to drop the CdkDrag to know what index the item will drop into.

What are the steps to reproduce?

Providing a StackBlitz reproduction is the best way to share your issue.

StackBlitz starter: https://goo.gl/wwnhMV

What is the use-case or motivation for changing an existing behavior?

It would be beneficial to know this so that designers can provide additional context of where the user is preparing to drop an item. For example: Dragging a numbered list, showing the numeric position of the drop target in the placeholder.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Material/Cdk > 7.0.1

Is there anything else we should know?

There is already a basis for this functionality, with the CdkDropList's
_getItemIndexFromPointerPosition(item: CdkDrag, pointerX: number, pointerY: number, delta?: {x: number, y: number}) method and CdkDrag's CdkDragMoved ( source, pinterPosition, event, delta).
If _getItemIndexFromPointerPosition were public it would be trivial to implement a work-around so that we could get the required information.

Metadata

Metadata

Assignees

Labels

P4A relatively minor issue that is not relevant to core functions

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions