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

Jittery movement when draggable uses nodeRef, smooth movement when using handle #761

Open
viveleroi opened this issue Aug 28, 2024 · 1 comment

Comments

@viveleroi
Copy link

viveleroi commented Aug 28, 2024

Looks like nodeRef causes jittery movement when the handle is not a direct ancestor. For example, using the nodeRef example from the README and adding a div wrapping the target causes this issue.

We're updating draggable modal windows to use nodeRef props to avoid the console warning about findDOMNode being deprecated. Previously, we had handle set to a DOM class name and that exact class name assigned to an element inside the element.

<Draggable nodeRef={dragRef}>
  <div>
     <header className={clsx(styles.header, styles[uiVariant])} ref={dragRef}>/* content */</header>
  </div>
</Draggable>

chrome_JpWDOI93H2

With the handle approach, the movement when dragging and item was smooth and we had no issues. With the nodeRef, it's incredibly jittery. We normally have bounds and onDragStart methods but I removed those for testing and the jitter persists.

@troywoy
Copy link

troywoy commented Sep 3, 2024

Minimal reproduction: https://codesandbox.io/p/sandbox/nlpcgq

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants