angular / angular/components

bug(cdkDropList): cdkDropList doesn't pick up dynamically added connected dropLists.

オープン
#22,508 コメント 3 件 リアクション 10 件 担当者 0 名 GitHub で見る
area: cdk/drag-drop feature P4
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
91

説明

#### Reproduction

We have a use case where we must dynamically add extra cdkDropList on the fly. In the [this StackBlitz](https://stackblitz.com/edit/cdk-droplist-sample-1) this is simulated by a ngIf.
When you drag an item from folder-2 to folder-0 folder 1 will open, but it doesn't accept the items. However, if you move it first to 0 then to 2, and back to 1, it will suddenly do. The same goes for eventual multiple added lists.


#### Expected Behavior

The behavior one would expect is demonstrated in [this StackBlitz](https://stackblitz.com/edit/cdk-droplist-sample-workaround?file=src/app/app.component.ts).
While this is working it's using undocumented internals, and forcing the connectedTo in 2 different ways, where I can not predict long-term stability.

#### Actual Behavior
The actual behavior is demonstrated in the first linked StackBlitx.
When we go from this:
![image](https://user-images.githubusercontent.com/1249083/115239341-e51e6f80-a11e-11eb-8b8b-897ab594e1be.png)
to:
![image](https://user-images.githubusercontent.com/1249083/115239399-f49db880-a11e-11eb-8901-34f725a097b0.png)
The folder-1 isn't accepting the item dragged on top of it

#### Environment

- Angular: 11.any
- CDK/Material: 11.any
- Browser(s): all
- Operating System (e.g. Windows, macOS, Ubuntu): all

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start with the two linked StackBlitz reproductions, especially src/app/app.component.ts in the workaround, and reproduce the drag after ngIf adds folder-1. Trace how cdkDropList discovers connected lists during that update. Done means a dynamically added list accepts the item on the first drag without relying on undocumented internals; the payload names no project test.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, typescript
領域
frontend
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。