Skip to content

Commit 95b410c

Browse files
fix: allow reordering grid columns inside a draggable parent (#10091) (#10093)
Co-authored-by: Tomi Virkki <[email protected]>
1 parent 811e267 commit 95b410c

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

packages/grid/src/vaadin-grid-column-reordering-mixin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ export const ColumnReorderingMixin = (superClass) =>
127127
return;
128128
}
129129

130-
// Cancel reordering if there are draggable nodes on the event path
130+
// Cancel reordering if there are draggable nodes on the event path following this element
131131
const path = e.composedPath && e.composedPath();
132-
if (path && path.some((node) => node.hasAttribute && node.hasAttribute('draggable'))) {
132+
if (path && path.slice(0, Math.max(0, path.indexOf(this))).some((node) => node.draggable)) {
133133
return;
134134
}
135135

packages/grid/test/column-reordering.test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,13 @@ describe('reordering with draggable contents', () => {
710710
expect(grid.hasAttribute('reordering')).to.be.false;
711711
});
712712

713+
it('should start reordering inside draggable parent', () => {
714+
const parent = fixtureSync('<div draggable="true"></div>');
715+
parent.appendChild(grid);
716+
dragStart(visualColumnCellContents[0][1]);
717+
expect(grid.hasAttribute('reordering')).to.be.true;
718+
});
719+
713720
it('should not start reordering inside draggable footer cell content', () => {
714721
dragStart(visualColumnCellContents[0][2].children[0]);
715722
expect(grid.hasAttribute('reordering')).to.be.false;

0 commit comments

Comments
 (0)