From 6a2ab550a253a4a1f35e4e81a120fa9247ce753b Mon Sep 17 00:00:00 2001 From: ghiscoding Date: Fri, 1 Dec 2023 11:08:16 -0500 Subject: [PATCH] fix: only allow row drag on cell w/`dnd` or `cell-reorder`, fix #937 - 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` --- packages/common/src/core/slickGrid.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/common/src/core/slickGrid.ts b/packages/common/src/core/slickGrid.ts index 5171c4cbd..eb83497a7 100644 --- a/packages/common/src/core/slickGrid.ts +++ b/packages/common/src/core/slickGrid.ts @@ -816,7 +816,8 @@ export class SlickGrid = Column, 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),