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

Dropzone doesn't respect Autoscroll's scroll when the container option is set and the window doesn't scroll with the container #1041

Open
BenKluwe opened this issue May 23, 2024 · 0 comments

Comments

@BenKluwe
Copy link

If you have questions about the API that aren't answered in the docs or FAQ, try asking in the Gitter chatroom or on Stackoverflow.

If you've found something that looks like a bug, include a link to a minimal demo on JSFilddle, Codepen with instructions to reproduce the bug with and roughly follow the following issue description format:

Expected behavior

When using autoscroll in a draggable with a specified element, the dropzones should respect the elements rect when scrolled. This happened to me when I used two lists side-by-side inside a container. Dragging an element from one list to the other works but as soon as you scroll and backtrack a little bit the wrong element is selected as the active dropzone.

Actual behavior

When setting a container element for autoscroll the item's rect isn't calculated when scrolled. Instead, the window's scroll is used which doesn't work when the window hasn't scrolled but the element has. This behaviour happens when using pointer, center or a number as the dropzone's overlap option.

System configuration

interact.js version: 1.10.26
Browser name and version: Chromium
Operating System: Linux

Relevant lines of code

I have dug through the code and see this is where the droppactive state is detected:

const dragRect = draggable.getRect(draggableElement)

following through below is where the scroll is calculated and applied and it seems it is using just the window's scroll, not the set autoscroll container element:
const scroll = getScrollXY(win.getWindow(element))

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

1 participant