Skip to content

Commit 5f07b93

Browse files
driskullbenelan
authored andcommitted
fix(sort-handle): allow move and reorder events to be cancelled (#12095)
**Related Issue:** #11774 ## Summary - allows events to be cancelled - This is inconsistent with the other events where the propagation is being stopped when needed - see https://github.com/Esri/calcite-design-system/blob/b1c2b56c883ea3dc59c7fbc121e364b337c12d9d/packages/calcite-components/src/components/block/block.tsx#L312-L332
1 parent aef4806 commit 5f07b93

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

packages/calcite-components/src/components/sort-handle/sort-handle.e2e.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,9 @@ describe("calcite-sort-handle", () => {
7575

7676
await page.keyboard.press("Enter");
7777
await page.waitForChanges();
78-
expect(await calciteSortHandleReorderSpy.lastEvent.detail.reorder).toBe(REORDER_VALUES[0]);
78+
expect(calciteSortHandleReorderSpy.lastEvent.detail.reorder).toBe(REORDER_VALUES[0]);
7979
expect(calciteSortHandleReorderSpy).toHaveReceivedEventTimes(1);
80+
expect(calciteSortHandleReorderSpy.lastEvent.cancelable).toBe(true);
8081
});
8182

8283
it("fires calciteSortHandleMove event", async () => {
@@ -104,8 +105,9 @@ describe("calcite-sort-handle", () => {
104105

105106
await page.keyboard.press(" ");
106107
await page.waitForChanges();
107-
expect(await calciteSortHandleMoveSpy.lastEvent.detail.moveTo.id).toBe(moveToItems[1].id);
108+
expect(calciteSortHandleMoveSpy.lastEvent.detail.moveTo.id).toBe(moveToItems[1].id);
108109
expect(calciteSortHandleMoveSpy).toHaveReceivedEventTimes(1);
110+
expect(calciteSortHandleMoveSpy.lastEvent.cancelable).toBe(true);
109111
});
110112

111113
it("is disabled when no moveToItems, setPosition < 1 or setSize < 2", async () => {

packages/calcite-components/src/components/sort-handle/sort-handle.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,13 @@ export class SortHandle extends LitElement implements InteractiveComponent {
136136
calciteSortHandleClose = createEvent({ cancelable: false });
137137

138138
/** Fires when a move item has been selected. */
139-
calciteSortHandleMove = createEvent<MoveEventDetail>({ cancelable: false });
139+
calciteSortHandleMove = createEvent<MoveEventDetail>({ cancelable: true });
140140

141141
/** Fires when the component is open and animation is complete. */
142142
calciteSortHandleOpen = createEvent({ cancelable: false });
143143

144144
/** Fires when a reorder has been selected. */
145-
calciteSortHandleReorder = createEvent<ReorderEventDetail>({ cancelable: false });
145+
calciteSortHandleReorder = createEvent<ReorderEventDetail>({ cancelable: true });
146146

147147
// #endregion
148148

0 commit comments

Comments
 (0)