yousoph opened a new pull request, #41637: URL: https://github.com/apache/superset/pull/41637
### SUMMARY Reordering selected pills within an Explore control (metrics, columns, filters, etc.) by dragging is broken: the pill snaps back and the order is unchanged. Dragging a new column/metric *in* from the Datasource panel still works — only reordering is broken. **Root cause:** the react-dnd → @dnd-kit migration ([#37880](https://github.com/apache/superset/pull/37880), SIP-184) left the Explore `<DndContext>` using @dnd-kit's default `rectIntersection` collision detection. Each control registers a large parent dropzone (`dropzone-<name>`) that geometrically **encloses every pill**, so during an intra-control reorder the parent dropzone always wins the largest-intersection tie-break. `resolveDragEnd` then sees an `over` target with no `dragIndex` and silently no-ops. External drops from the Datasource panel kept working because they legitimately target that parent dropzone (which exposes `onDrop`) — which is why only reordering was reported broken. **Fix:** a scoped collision-detection strategy (`exploreCollisionDetection`) passed to `DndContext` that resolves collisions by the drag's intent: - Reordering an existing pill (active data carries a `dragIndex`) → collide **only** with sibling sortables of the same `type`, resolved by `closestCenter`. - Dragging a new item in from the panel → collide **only** with parent dropzones exposing an `onDrop` handler (`pointerWithin`, with a `rectIntersection` fallback). This restores reordering and makes external drops onto already-populated controls more robust (pills can no longer intercept them). ### BEFORE/AFTER Before: dragging a metric/column pill within a control to reorder it does nothing — the pill returns to its original position. After: pills reorder as expected; dragging items in from the Datasource panel continues to work. ### TESTING INSTRUCTIONS 1. Open any chart in Explore with 2+ metrics or group-by columns (or add them). 2. Drag one pill above/below another within the same control. 3. The order should update and persist. 4. Confirm dragging a new column/metric in from the Datasource panel still works. Automated: added 3 unit tests to `ExploreDndContext.test.tsx` asserting the collision scoping (which droppables each detector receives). jsdom cannot drive @dnd-kit pointer sensors, so the scoping logic is tested directly rather than via a simulated pointer drag. ### ADDITIONAL INFORMATION - [ ] Has associated issue: relates to the @dnd-kit migration [#37880](https://github.com/apache/superset/pull/37880); also relevant to [#33951](https://github.com/apache/superset/issues/33951) (index-based sortable IDs remain a separate latent cosmetic issue, not addressed here to keep this fix targeted). - [x] Required feature flags: n/a - [ ] Changes UI - [ ] Migration is atomic - [ ] Introduces new feature or API - [x] Removes existing feature or API -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
