clauderic / dnd-kit

The modern, lightweight, performant, accessible and extensible drag & drop toolkit for React.
http://dndkit.com
MIT License
11.9k stars 602 forks source link

AutoScroll absolute thresholds and acceleration #1414

Open Goues opened 1 month ago

Goues commented 1 month ago

Hey, I'm in the process of migrating from an old and outdated drag and drop library to DND Kit and it's been a great experience. There is just one issue I don't think I can solve easily with available public API. My drag & drop is across the full document, like sorting elements on the whole website. The height of the document can be like 10000 pixels as a result.

However, the autoScroll component of DND Kit uses relative values for acceleration and thresholds, so if I take the default threshold of 0.2, I get scrolling all over the place, because 20 % of 10000 pixels is pretty much the entire viewport. However, I can't choose a super low value because the document can be small.

Does anybody have any ideas for making auto scroll work with absolute values instead? I'd like to set threshold to 200 pixels or something like that.