mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 20:45:00 -05:00
On a board large enough to have scrollbars in both directions, dragging a card sometimes moved the card, sometimes scrolled the list, sometimes scrolled the board, and often several of those at once, so the card could not be dropped where it was aimed. A board runs three drag-scroll implementations over the same pointer: the dragscroll library, bound separately to `.board-canvas`, to every swimlane and to every lane; the `mousedown .board-canvas` lane pan in swimlanes.js; and jQuery UI sortable, which is the one that is supposed to move the card. Nothing stood any of them down while a drag was in progress. swimlanes.js did try, for list drags, but called `dragscroll.reset()` FIRST and removed the class afterwards - reset() binds to whatever carries the class at that moment, so the listeners stayed - and it left the canvas tagged anyway. The lane pan ignored the `nodragscroll` marker the library honours, so pressing a minicard, which carries that marker exactly because it is the card's drag handle, started a horizontal pan that ran alongside the card drag. Now client/lib/boardDragscroll.js suspends drag-scrolling for the whole drag - class off, THEN reset - and restores exactly the elements it took it from, so a board route does not gain panning it deliberately turned off. Every sortable on the board (cards, lists, swimlanes) suspends in start and resumes in stop, a window mouseup/touchend/dragend restores in case a drag never reaches its stop handler, and a swimlane re-rendered mid-drag does not re-arm panning under the pointer. The lane pan now refuses to start on `.nodragscroll` or on a drag handle, and gives way if a drag begins after the press. The drag handles themselves are marked `nodragscroll`: a press on a handle moves the item, it never pans the board. tests/boardDragScrollDuringDrag.test.cjs pins the order of the two steps, the restore-what-was-suspended rule, the safety net, the suspend/resume in every sortable and the two markers; specs/37-card-drag-sort.e2e.js drags a card sideways on a 12-list board and pins that neither the lane nor the canvas scrolls while it moves, and that panning is back afterwards. Thanks to mueschel and xet7 ! Fixes #6558,