components icon indicating copy to clipboard operation
components copied to clipboard

Drag-and-drop is offset inside dialog if page is scrolled before opening dialog

Open pmilic021 opened this issue 8 years ago • 14 comments

Bug, feature request, or proposal:

Bug

What is the expected behavior?

After scrolling the page and then opening dialog, any drag-and-drop list in the dialog component should work properly.

What is the current behavior?

The drag-and-drop list's drop placeholder is offset aprox by the amount scrolled before opening the dialog.

What are the steps to reproduce?

I came across an example of this while looking for possible solution prior to making this issue: @cisasteelersfan made it in one other ticket (that issue is not the same as this one!) https://github.com/angular/material2/issues/13508#issuecomment-432428242

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

It is pretty common use case to have drag-and-drop in a dialog

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

7.0.2

Is there anything else we should know?

pmilic021 avatar Nov 26 '18 20:11 pmilic021

I have the same issue in 7.1.1 Angular Material.

belerofont avatar Dec 17 '18 12:12 belerofont

@crisbeto hi, it would be nice to hear something, it is very important, thx

denkerny avatar Jan 10 '19 15:01 denkerny

@kernyden If it helps you, as a temporary workaround, I forced top to be 0 (usually it is set to the -scrollOffset before opening dialog):

.cdk-global-scrollblock {
    top: 0 !important;
}

This way there won't be no offset in drag and drop, but opening a dialog will look a bit ugly.

pmilic021 avatar Jan 10 '19 15:01 pmilic021

@pmilic021 no, it hasn't helped me, this thing reproduces not only on modal, it happens with lists have scroll.

denkerny avatar Jan 11 '19 09:01 denkerny

Try to add something like this to your global styles:

.cdk-global-scrollblock {
   position: initial !important;
   overflow: hidden !important;
}

ghost avatar Feb 28 '19 09:02 ghost

@radzix23 in actual version of cdk dnd we cant scroll with an active dnd effect :( - https://github.com/angular/material2/issues/13588

denkerny avatar Feb 28 '19 12:02 denkerny

I have the same issue in ^7.3.7 Angular Material.

linjie0928 avatar Apr 22 '19 06:04 linjie0928

Any update on this issue?

hijamoya avatar Apr 08 '20 08:04 hijamoya

In Angular material 10 this is still an issue... Will it be fixed?

BlindDespair avatar Sep 04 '20 13:09 BlindDespair

Same issue, Angular material 10

Temporary workaround... .cdk-global-scrollblock { top: 0 !important; }

Art2058 avatar Oct 06 '20 07:10 Art2058

This is still an issue for me and none of the workarounds seem to work for me, any solution to this?

BrettKessler avatar Oct 29 '20 17:10 BrettKessler

We just ran into this bug. Same symptoms - drag n drop in a dialog. Offsets are way off when dragging if page has been scrolled. Works correctly if page is not scrolled.

This does not work: .cdk-global-scrollblock { top: 0 !important; } This works but will be deprecated and against our internal policy. ::ng-deep html.cdk-global-scrollblock { top: 0px !important; }

After 2 years and multiple reports is anyone reviewing?

tameyer1 avatar Nov 11 '20 19:11 tameyer1

Hey all, I'm also having this issue.

Made a stackblitz for reference: https://stackblitz.com/edit/drag-and-drop-inside-modal-bug

Using .cdk-global-scrollblock { top: 0 !important; } in my project's global styling worked for me.

condericson avatar Apr 26 '21 19:04 condericson

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.