From efb004b1f737a89a91fbd494264f0a215d90f0af Mon Sep 17 00:00:00 2001 From: Matt Driscoll Date: Tue, 5 Dec 2023 16:18:25 -0800 Subject: [PATCH 1/3] fix(action-menu): fix closing action menu after a drag occurs. #7445 --- .../components/action-menu/action-menu.tsx | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/packages/calcite-components/src/components/action-menu/action-menu.tsx b/packages/calcite-components/src/components/action-menu/action-menu.tsx index d24fd9f4ddd..a6d07785879 100755 --- a/packages/calcite-components/src/components/action-menu/action-menu.tsx +++ b/packages/calcite-components/src/components/action-menu/action-menu.tsx @@ -4,7 +4,6 @@ import { Event, EventEmitter, h, - Listen, Method, Prop, State, @@ -133,21 +132,6 @@ export class ActionMenu implements LoadableComponent { */ @Event({ cancelable: false }) calciteActionMenuOpen: EventEmitter; - @Listen("pointerdown", { target: "window" }) - closeCalciteActionMenuOnClick(event: PointerEvent): void { - if (!isPrimaryPointerButton(event)) { - return; - } - - const composedPath = event.composedPath(); - - if (composedPath.includes(this.el)) { - return; - } - - this.open = false; - } - // -------------------------------------------------------------------------- // // Private Properties @@ -304,10 +288,12 @@ export class ActionMenu implements LoadableComponent { return ( { + this.open = false; + }; } From f578f1471525b46e274e8b4f53133c59da08d1d6 Mon Sep 17 00:00:00 2001 From: Matt Driscoll Date: Tue, 5 Dec 2023 16:28:28 -0800 Subject: [PATCH 2/3] update existing test. --- .../src/components/action-menu/action-menu.e2e.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/calcite-components/src/components/action-menu/action-menu.e2e.ts b/packages/calcite-components/src/components/action-menu/action-menu.e2e.ts index 772c1b60644..5ebc0677d44 100755 --- a/packages/calcite-components/src/components/action-menu/action-menu.e2e.ts +++ b/packages/calcite-components/src/components/action-menu/action-menu.e2e.ts @@ -135,6 +135,10 @@ describe("calcite-action-menu", () => { const actionMenu = await page.find("calcite-action-menu"); + const popover = await page.find("calcite-action-menu >>> calcite-popover"); + + expect(await popover.getProperty("autoClose")).toBe(true); + expect(await actionMenu.getProperty("open")).toBe(true); const outside = await page.find("#outside"); From bb30e41bea6696536c0f16b97d882fb0f9170b3a Mon Sep 17 00:00:00 2001 From: Matt Driscoll Date: Tue, 5 Dec 2023 16:35:43 -0800 Subject: [PATCH 3/3] review fixes --- .../src/components/action-menu/action-menu.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/calcite-components/src/components/action-menu/action-menu.tsx b/packages/calcite-components/src/components/action-menu/action-menu.tsx index a6d07785879..556f1b5783f 100755 --- a/packages/calcite-components/src/components/action-menu/action-menu.tsx +++ b/packages/calcite-components/src/components/action-menu/action-menu.tsx @@ -293,7 +293,7 @@ export class ActionMenu implements LoadableComponent { focusTrapDisabled={true} label={label} offsetDistance={0} - onCalcitePopoverClose={this.close} + onCalcitePopoverClose={this.handlePopoverClose} open={open} overlayPositioning={overlayPositioning} placement={placement} @@ -500,7 +500,7 @@ export class ActionMenu implements LoadableComponent { this.open = value; }; - close = (): void => { + private handlePopoverClose = (): void => { this.open = false; }; }