Skip to content

Commit

Permalink
fix: only allow row drag on cell w/dnd or cell-reorder, fix #937
Browse files Browse the repository at this point in the history
- 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`
  • Loading branch information
ghiscoding-SE committed Dec 1, 2023
1 parent 7483b29 commit 6a2ab55
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/common/src/core/slickGrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,8 @@ export class SlickGrid<TData = any, C extends Column<TData> = Column<TData>, O e
this.slickDraggableInstance = Draggable({
containerElement: this._container,
allowDragFrom: 'div.slick-cell',
allowDragFromClosest: 'div.slick-cell',
// the slick cell parent must always contain `.dnd` and/or `.cell-reorder` class to be identified as draggable
allowDragFromClosest: 'div.slick-cell.dnd, div.slick-cell.cell-reorder',
onDragInit: this.handleDragInit.bind(this),
onDragStart: this.handleDragStart.bind(this),
onDrag: this.handleDrag.bind(this),
Expand Down

0 comments on commit 6a2ab55

Please sign in to comment.