dnd-kit
dnd-kit copied to clipboard
AutoScroll option to scroll only horizontally/vertically
Hi,
I wanted to make container auto-scroll only on horizontal axis. I managed to do so with:
<DndContext autoScroll={{ threshold: { x: 0.2, y: 0 } }} >
I used 0.2 as it is a default value.
I was wondering if there was a cleaner way to achieve this and if not, would you accept a PR with a new AutoScrollOption that could enforce this behaviour.
There is a restrictToHorizontalAxis
modifier which can be imported from @dnd-kit/modifiers
import { restrictToHorizontalAxis } from "@dnd-kit/modifiers";
<DndContext modifiers={[restrictToHorizontalAxis]} >
The problem with using the restrictToHorizontalAxis
modifier is that it also restricts other elements like the dragOverlay.