angular / angular/components

bug(drag-drop): Slot content not visible when we start dragging an element

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

説明

### Is this a regression?

- [ ] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

_No response_

### Description

Hi,

Background:
I am creating a reusable dynamic list component which also has the ability to drag and drop items in a list.
This component uses **slots** to dynamically project content from the consumer component.

Problem:
The component renders correctly.
But when I start dragging an item, the content in the slot is not visible.

Does anyone know how to solve this issue or any workaround for this?

@angular/cdk
@angular/cdk/drag-drop

Thanks!

### Reproduction

StackBlitz link: https://stackblitz.com/edit/stackblitz-starters-jbsaba?file=src%2Fmain.ts
Steps to reproduce:
1. Click on "Item 1 in slot" and start dragging it.
2. Notice that the text "Item 1 in slot" is not visible while you are dragging the item.

### Expected Behavior

Any content in a slot element should be visible while dragging the element.

### Actual Behavior

Content in the slot is not visible while you are dragging the item.

### Environment

- Angular: 16.2.7
- CDK/Material: 16.2.6
- Browser(s): Chrome
- Operating System: macOS

### REASON -
I am still debugging but found the reason behind this problem.
As per documentation,
"When a cdkDrag element is picked up, it will create a preview element visible while dragging."
This causes another slot element to be created with the same name which is why we don't see its content.

Still trying to find a solution.

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

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

調査の方向性

リンクされた StackBlitz の再現環境を開き、src/main.ts から始めます。「Item 1 in slot」をドラッグして、投影されたスロットコンテンツがドラッグプレビューに表示されないことを確認します。ドラッグ中もスロットのテキストが表示されたままで、再現手順が引き続き成功すれば完了です。

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

評価

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

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

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