Skip to content
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

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

Closed
pmilic021 opened this issue Nov 26, 2018 · 14 comments · Fixed by #14806
Closed

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

pmilic021 opened this issue Nov 26, 2018 · 14 comments · Fixed by #14806
Assignees
Labels
area: cdk/drag-drop area: material/dialog P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@pmilic021
Copy link

pmilic021 commented Nov 26, 2018

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!)
#13508 (comment)

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?

@belerofont
Copy link

I have the same issue in 7.1.1 Angular Material.

@denkerny
Copy link

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

@pmilic021
Copy link
Author

pmilic021 commented Jan 10, 2019

@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.

@denkerny
Copy link

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

@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent has pr labels Jan 12, 2019
crisbeto added a commit to crisbeto/material2 that referenced this issue Jan 12, 2019
…d scrolling

We use the `ViewportRuler` to determine how much a page has been scrolled in order to compensate for it in some of the `ClientRect`-related calculations. This breaks down when the drop list is inside a dialog with blocked scrolling, because scroll blocking works by offsetting the `html` node which in turn throws off the `ViewportRuler`. These changes switches to reading the values off the `window` which won't be thrown off.

Fixes angular#14280.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jan 12, 2019
…d scrolling

We use the `ViewportRuler` to determine how much a page has been scrolled in order to compensate for it in some of the `ClientRect`-related calculations. This breaks down when the drop list is inside a dialog with blocked scrolling, because scroll blocking works by offsetting the `html` node which in turn throws off the `ViewportRuler`. These changes switches to reading the values off the `window` which won't be thrown off.

Fixes angular#14280.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jan 26, 2019
…d scrolling

We use the `ViewportRuler` to determine how much a page has been scrolled in order to compensate for it in some of the `ClientRect`-related calculations. This breaks down when the drop list is inside a dialog with blocked scrolling, because scroll blocking works by offsetting the `html` node which in turn throws off the `ViewportRuler`. These changes switches to reading the values off the `window` which won't be thrown off.

Fixes angular#14280.
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 10, 2019
…d scrolling

We use the `ViewportRuler` to determine how much a page has been scrolled in order to compensate for it in some of the `ClientRect`-related calculations. This breaks down when the drop list is inside a dialog with blocked scrolling, because scroll blocking works by offsetting the `html` node which in turn throws off the `ViewportRuler`. These changes switches to reading the values off the `window` which won't be thrown off.

Fixes angular#14280.
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 11, 2019
…d scrolling

We use the `ViewportRuler` to determine how much a page has been scrolled in order to compensate for it in some of the `ClientRect`-related calculations. This breaks down when the drop list is inside a dialog with blocked scrolling, because scroll blocking works by offsetting the `html` node which in turn throws off the `ViewportRuler`. These changes switches to reading the values off the `window` which won't be thrown off.

Fixes angular#14280.
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 11, 2019
…d scrolling

We use the `ViewportRuler` to determine how much a page has been scrolled in order to compensate for it in some of the `ClientRect`-related calculations. This breaks down when the drop list is inside a dialog with blocked scrolling, because scroll blocking works by offsetting the `html` node which in turn throws off the `ViewportRuler`. These changes switches to reading the values off the `window` which won't be thrown off.

Fixes angular#14280.
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 11, 2019
…d scrolling

We use the `ViewportRuler` to determine how much a page has been scrolled in order to compensate for it in some of the `ClientRect`-related calculations. This breaks down when the drop list is inside a dialog with blocked scrolling, because scroll blocking works by offsetting the `html` node which in turn throws off the `ViewportRuler`. These changes switches to reading the values off the `window` which won't be thrown off.

Fixes angular#14280.
@ghost
Copy link

ghost commented Feb 28, 2019

Try to add something like this to your global styles:

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

@denkerny
Copy link

denkerny commented Feb 28, 2019

@radzix23 in actual version of cdk dnd we cant scroll with an active dnd effect :( - #13588

crisbeto added a commit to crisbeto/material2 that referenced this issue Apr 7, 2019
…d scrolling

We use the `ViewportRuler` to determine how much a page has been scrolled in order to compensate for it in some of the `ClientRect`-related calculations. This breaks down when the drop list is inside a dialog with blocked scrolling, because scroll blocking works by offsetting the `html` node which in turn throws off the `ViewportRuler`. These changes switches to reading the values off the `window` which won't be thrown off.

Fixes angular#14280.
@linjie0928
Copy link

I have the same issue in ^7.3.7 Angular Material.

crisbeto added a commit to crisbeto/material2 that referenced this issue Jul 16, 2019
…d scrolling

We use the `ViewportRuler` to determine how much a page has been scrolled in order to compensate for it in some of the `ClientRect`-related calculations. This breaks down when the drop list is inside a dialog with blocked scrolling, because scroll blocking works by offsetting the `html` node which in turn throws off the `ViewportRuler`. These changes switches to reading the values off the `window` which won't be thrown off.

Fixes angular#14280.
crisbeto added a commit to crisbeto/material2 that referenced this issue Aug 6, 2019
…d scrolling

We use the `ViewportRuler` to determine how much a page has been scrolled in order to compensate for it in some of the `ClientRect`-related calculations. This breaks down when the drop list is inside a dialog with blocked scrolling, because scroll blocking works by offsetting the `html` node which in turn throws off the `ViewportRuler`. These changes switches to reading the values off the `window` which won't be thrown off.

Fixes angular#14280.
@hijamoya
Copy link

hijamoya commented Apr 8, 2020

Any update on this issue?

@BlindDespair
Copy link

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

@Art2058
Copy link

Art2058 commented Oct 6, 2020

Same issue,
Angular material 10

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

@BrettKessler
Copy link

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

@tameyer1
Copy link

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?

@condericson
Copy link

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.

crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 23, 2022
…ocked scrolling

We use the `ViewportRuler` to determine how much a page has been scrolled in order to compensate for it in some of the `ClientRect`-related calculations. This breaks down when the drop list is inside a dialog with blocked scrolling, because scroll blocking works by offsetting the `html` node which in turn throws off the `ViewportRuler`. These changes switches to reading the values off the `window` which won't be thrown off.

Fixes angular#14280.
crisbeto added a commit that referenced this issue Feb 23, 2022
…ocked scrolling (#14806)

We use the `ViewportRuler` to determine how much a page has been scrolled in order to compensate for it in some of the `ClientRect`-related calculations. This breaks down when the drop list is inside a dialog with blocked scrolling, because scroll blocking works by offsetting the `html` node which in turn throws off the `ViewportRuler`. These changes switches to reading the values off the `window` which won't be thrown off.

Fixes #14280.

(cherry picked from commit 3e1de9d)
crisbeto added a commit that referenced this issue Feb 23, 2022
…ocked scrolling (#14806)

We use the `ViewportRuler` to determine how much a page has been scrolled in order to compensate for it in some of the `ClientRect`-related calculations. This breaks down when the drop list is inside a dialog with blocked scrolling, because scroll blocking works by offsetting the `html` node which in turn throws off the `ViewportRuler`. These changes switches to reading the values off the `window` which won't be thrown off.

Fixes #14280.
@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 Mar 26, 2022
forsti0506 pushed a commit to forsti0506/components that referenced this issue Apr 3, 2022
…ocked scrolling (angular#14806)

We use the `ViewportRuler` to determine how much a page has been scrolled in order to compensate for it in some of the `ClientRect`-related calculations. This breaks down when the drop list is inside a dialog with blocked scrolling, because scroll blocking works by offsetting the `html` node which in turn throws off the `ViewportRuler`. These changes switches to reading the values off the `window` which won't be thrown off.

Fixes angular#14280.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: cdk/drag-drop area: material/dialog P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet