From 9832bccb4aef78a7c5120bb6b8cbf9ee9e048dc4 Mon Sep 17 00:00:00 2001 From: abaicu Date: Thu, 4 Sep 2025 17:32:51 +0300 Subject: [PATCH 1/3] fix(menu): prevent overlay close --- packages/menu/src/Menu.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/packages/menu/src/Menu.ts b/packages/menu/src/Menu.ts index 28cbfb6f743..8abea300b8a 100644 --- a/packages/menu/src/Menu.ts +++ b/packages/menu/src/Menu.ts @@ -103,30 +103,30 @@ export class Menu extends SizedMixin(SpectrumElement, { noDefaultSize: true }) { /** * Minimum vertical movement (in pixels) required to trigger scrolling detection. - * + * * This threshold is consistent with other components in the design system: * - Card component uses 10px for click vs. drag detection * - Menu component uses 10px for scroll vs. selection detection - * + * * The 10px threshold is carefully chosen to: * - Allow for natural finger tremor and accidental touches * - Distinguish between intentional scroll gestures and taps * - Provide consistent behavior across the platform - * + * * @see {@link packages/card/src/Card.ts} for similar threshold usage */ private scrollThreshold = 10; // pixels /** * Maximum time (in milliseconds) for a movement to be considered scrolling. - * + * * This threshold is consistent with other timing values in the design system: * - Longpress duration: 300ms (ActionButton, LongpressController) * - Scroll detection: 300ms (Menu component) - * + * * Quick movements within this timeframe are likely intentional scrolls, * while slower movements are more likely taps or selections. - * + * * @see {@link packages/action-button/src/ActionButton.ts} for longpress duration * @see {@link packages/overlay/src/LongpressController.ts} for longpress duration */ @@ -576,7 +576,7 @@ export class Menu extends SizedMixin(SpectrumElement, { noDefaultSize: true }) { * Resets the scrolling state after a short delay (100ms) to allow for * any final touch events to be processed. This delay prevents immediate * state changes that could interfere with the selection logic. - * + * * The 100ms delay is consistent with the design system's approach to * touch event handling and ensures that any final touch events or * gesture recognition can complete before the scrolling state is reset. @@ -873,10 +873,6 @@ export class Menu extends SizedMixin(SpectrumElement, { noDefaultSize: true }) { document.addEventListener('keyup', replaceTabindex); this.addEventListener('focusout', replaceTabindex); } - if (key === 'Tab') { - this.closeDescendentOverlays(); - return; - } if (openSubmenuKey && root?.hasSubmenu && !root.open) { // Remove focus while opening overlay from keyboard or the visible focus // will slip back to the first item in the menu. From 80080df16125277a3a281a8856bfc74e680b8361 Mon Sep 17 00:00:00 2001 From: abaicu Date: Thu, 4 Sep 2025 17:49:10 +0300 Subject: [PATCH 2/3] style(menu): lint From 66b14fb740cbdfb78ffb177af5a34861878f2a0e Mon Sep 17 00:00:00 2001 From: abaicu Date: Thu, 4 Sep 2025 17:50:33 +0300 Subject: [PATCH 3/3] style(menu): lint spaces