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

[Experimental] RestrictToElement breaks after one drag operation #1573

Open
smahs opened this issue Dec 24, 2024 · 1 comment
Open

[Experimental] RestrictToElement breaks after one drag operation #1573

smahs opened this issue Dec 24, 2024 · 1 comment

Comments

@smahs
Copy link

smahs commented Dec 24, 2024

The bounds work fine when the below code is first run. After the first drag (it doesn't matter which element or where it is dragged), the drag movements are no longer bounded. RestrictTo*Axis helps a bit for mouse drags, but the keyboard dragging suffers if the list is long and inside an overflow-scroll container.

Code used to test:

const container = document.getElementById('container')!;

const modifiers = [
  RestrictToElement.configure({ element: container }),
]
const manager = new DragDropManager({ modifiers });

const itemNodes = container.children;
Array.from(itemNodes).map((item, index) => {
  new Sortable({
    id: index,
    index: index,
    element: item,
  }, manager);
});
@diogotr7
Copy link

I'm also hitting this. Using the library in React. Exact same symptoms, the first drag is correctly restricted, any other after is not. I'm also restricting to the vertical axis, which keeps working fine after the first drag.

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