angular / angular/components

CDKDragAndDrop: Collapse cdkDropList item contents on cdkDragStarted event

Open
#18,179 4 comments 8 reactions 0 assignees View on GitHub
area: cdk/drag-drop P3
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

### (Marked as troubleshooting since I wasn't sure if there was a known solution for this case)
#### What are you trying to do?

Collapse/hide the contents of all items in a cdkDropList upon starting a drag event, leaving a condensed view of labels that is easier to sort.

#### What troubleshooting steps have you tried?

When starting the drag event, all items collapse except for the item currently being dragged, causing issues in the list placeholder when attempting to drop an item. Once the drop event is complete, the dropped item collapses and the list returns to normal.

#### Reproduction

StackBlitz: https://stackblitz.com/edit/components-issue-bt4kvt?file=app%2Fapp.component.ts

Steps to reproduce:
1. Set up a cdkDropList with items that contain a title and collapsible content panel.
2. Set the cdkDragStarted event for the list items to collapse all of the content panels.
3. Make sure all items in the list are expanded.
4. Begin dragging one of the items.

#### Environment

- Angular: 8.2.0
- CDK/Material: 8.2.3
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Windows

Contributor guide

Open the contributing guide

Research direction

Start with the linked StackBlitz reproduction and reproduce the behavior around the cdkDragStarted event on a cdkDropList. Inspect how the dragged item and list placeholder are sized while other item contents collapse. Done means dragging with collapsed item contents no longer causes placeholder issues, while the list returns to its normal state after dropping.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.