Skip to content

Commit 0f07161

Browse files
authored
fix: only allow row drag on cell w/dnd or cell-reorder (#939)
* fix: only allow row drag on cell w/`dnd` or `cell-reorder` - a previous PR #897 caused a regression on a cell with a select dropdown (like `Slick.Editors.YesNoSelect`), the regression was caused by the implementation of Draggable `allowDragFromClosest` which will check if current DOM element is `.slick-cell` or if not it will also try its ancestor and that caused the regression because the cell with the editor also had a `.slick-cell` and so the code taught that the user started a drag and it cancelled event bubbling which in turn also prevented the select dropdown to be clickable. - to fix this issue we need to make sure that the cell is queried not just with `div.slick-cell` but also with certain CSS classes, we need to check if parent has either `.dnd` or `.cell-reorder` to permit the dragging when checking parent cell with `allowDragFromClosest`
1 parent 3795c5f commit 0f07161

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

slick.grid.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,8 @@ if (typeof Slick === "undefined") {
619619
slickDraggableInstance = Slick.Draggable({
620620
containerElement: _container,
621621
allowDragFrom: 'div.slick-cell',
622-
allowDragFromClosest: 'div.slick-cell',
622+
// the slick cell parent must always contain `.dnd` and/or `.cell-reorder` class to be identified as draggable
623+
allowDragFromClosest: 'div.slick-cell.dnd, div.slick-cell.cell-reorder',
623624
onDragInit: handleDragInit,
624625
onDragStart: handleDragStart,
625626
onDrag: handleDrag,

0 commit comments

Comments
 (0)