Skip to content

Drag constraints do not update when draggable element's dimensions change #2458

@yusuf-9

Description

@yusuf-9

1. Read the FAQs 👇

2. Describe the bug

I have an element in my app that is both draggable and resizable. On first render, the element's drag constraints are set as the element's parent container ref. The drag constraints work perfectly up until the element's dimensions are changed. When this happens, the drag constraints do not update as a result of which the resized element begins overflowing the parent container.

3. IMPORTANT: Provide a CodeSandbox reproduction of the bug

https://codesandbox.io/p/sandbox/framer-motion-drag-constraints-issue-r233cy

4. Steps to reproduce

Steps to reproduce the behavior:

  1. Open the sandbox link shared above
  2. Drag the modal around the screen edges to confirm that the drag constraints are working as expected
  3. Resize the modal using the resize handle located towards to bottom right
  4. Drag the resized modal towards the edges to see the modal overflow / underflow the screen

5. Expected behavior

When a draggable element is resized, it's drag behavior around the drag limits remains the same as before. It does not unexpectedly begin overflowing / underflowing the drag limits.

6. Video or screenshots

Recording.638.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions