Skip to content

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

Closed

Description

@pmilic021

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?

Activity

  1. belerofont commented on Dec 17, 2018

    @belerofont

    I have the same issue in 7.1.1 Angular Material.

  2. denkerny commented on Jan 10, 2019

    @denkerny

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

  3. pmilic021 commented on Jan 10, 2019

    @pmilic021
    Author

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

  4. denkerny commented on Jan 11, 2019

    @denkerny

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

  5. added
    P3
    on Jan 12, 2019
  6. added 2 commits that reference this issue on Jan 12, 2019
    ce1bc90
    2ac201b
  7. added a commit that references this issue on Jan 26, 2019
    91e4c36
  8. added 4 commits that reference this issue on Feb 10, 2019
    dd57ced
    5b4ebe1
    46bc0a9
    ce3a3d1
  9. 5 remaining items

  10. hijamoya commented on Apr 8, 2020

    @hijamoya

    Any update on this issue?

  11. BlindDespair commented on Sep 4, 2020

    @BlindDespair

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

  12. Art2058 commented on Oct 6, 2020

    @Art2058

    Same issue,
    Angular material 10

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

  13. BrettKessler commented on Oct 29, 2020

    @BrettKessler

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

  14. tameyer1 commented on Nov 11, 2020

    @tameyer1

    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?

  15. condericson commented on Apr 26, 2021

    @condericson

    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.

  16. added a commit that references this issue on Feb 23, 2022
    3d65dcf
  17. added 2 commits that reference this issue on Feb 23, 2022
    74bae85
    3e1de9d
  18. angular-automatic-lock-bot commented on Mar 26, 2022

    @angular-automatic-lock-bot

    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.

  19. locked and limited conversation to collaborators on Mar 26, 2022
  20. added a commit that references this issue on Apr 3, 2022
    e32bd88
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P3area: cdk/drag-droparea: material/dialog

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions