Skip to content

CDK Drag and Drop: Placeholders don't appear on correct position when scrolling inside a list with fixed height. #18072

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
PinkTiu opened this issue Dec 30, 2019 · 2 comments · Fixed by #18082, lingounet/testage#9, hrueger/AGLight#112 or hrueger/AGLight#114
Assignees
Labels
feature This issue represents a new feature or feature request rather than a bug or bug fix P2 The issue is important to a large percentage of users, with a workaround

Comments

@PinkTiu
Copy link

PinkTiu commented Dec 30, 2019

Reproduction

The drag and drop element must be placed in a container with a fixed height. If the drag and drop list is bigger than the elements within a scrollbar should appear.
For example:

.container {
  height: 500px;
  overflow: scroll;
}
<div class="container">
  <div cdkDropList (cdkDropListDropped)="drop($event)">
    <div *ngFor="let movie of movies" cdkDrag>
      <div *cdkDragPlaceholder></div>
      {{movie}}
    </div>
  </div>
</div>

Now when you take a element and start scrolling the placeholders don't appear on the correct position. Instead it seems to me that the change in the height produced by scrolling is not considered in the calculation where the next placeholder should appear.

Use StackBlitz to reproduce your issue: https://stackblitz.com/edit/angular-jneyub

Steps to reproduce:

  1. Take a element and move it around to see the placeholder appear and disappear. When you don't scroll this works perfectly.
  2. No while dragging the element start scrolling. You will notice that the placeholders don't appear on the right place.

See this video: https://streamable.com/o9bs1

Expected Behavior

During scrolling the placeholders should appear on the correct place (the same place when scrolling is not used).

Actual Behavior

The placeholders don't appear at the correct position when using scrolling.

Environment

  • Angular: 8.2
  • CDK/Material: 8.2.3
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): macOS
crisbeto added a commit to crisbeto/material2 that referenced this issue Jan 1, 2020
…d viewport

Currently for performance reasons we only support scrolling within the drop list itself or the viewport, however in some cases the scrollable container might be different. These changes add a new input that consumers can use to tell the CDK which other parents can be scrolled.

Fixes angular#18072.
Relates to angular#13588.
@crisbeto crisbeto self-assigned this Jan 1, 2020
@crisbeto crisbeto added feature This issue represents a new feature or feature request rather than a bug or bug fix has pr P2 The issue is important to a large percentage of users, with a workaround labels Jan 1, 2020
crisbeto added a commit to crisbeto/material2 that referenced this issue Jan 1, 2020
…d viewport

Currently for performance reasons we only support scrolling within the drop list itself or the viewport, however in some cases the scrollable container might be different. These changes add a new input that consumers can use to tell the CDK which other parents can be scrolled.

Fixes angular#18072.
Relates to angular#13588.
@crisbeto
Copy link
Member

crisbeto commented Jan 1, 2020

Currently we only support scrolling either the list itself or the viewport. #18082 will add support for scrolling a different parent container.

crisbeto added a commit to crisbeto/material2 that referenced this issue Jan 11, 2020
…d viewport

Currently for performance reasons we only support scrolling within the drop list itself or the viewport, however in some cases the scrollable container might be different. These changes add a new input that consumers can use to tell the CDK which other parents can be scrolled.

Fixes angular#18072.
Relates to angular#13588.
jelbourn pushed a commit that referenced this issue Jan 22, 2020
…d viewport (#18082)

Currently for performance reasons we only support scrolling within the drop list itself or the viewport, however in some cases the scrollable container might be different. These changes add a new input that consumers can use to tell the CDK which other parents can be scrolled.

Fixes #18072.
Relates to #13588.
yifange pushed a commit to yifange/components that referenced this issue Jan 30, 2020
…d viewport (angular#18082)

Currently for performance reasons we only support scrolling within the drop list itself or the viewport, however in some cases the scrollable container might be different. These changes add a new input that consumers can use to tell the CDK which other parents can be scrolled.

Fixes angular#18072.
Relates to angular#13588.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature This issue represents a new feature or feature request rather than a bug or bug fix P2 The issue is important to a large percentage of users, with a workaround
Projects
None yet
2 participants