From df1765c48e7153d71a34b1ba26eacbef0ad92c53 Mon Sep 17 00:00:00 2001 From: Dustin Healy <54083382+dustinhealy@users.noreply.github.com> Date: Fri, 12 Dec 2025 14:45:00 -0800 Subject: [PATCH 1/2] fix: filter dropdown now closable with escape, doesn't close whole modal --- .../client/src/components/OriginalDialog.tsx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/client/src/components/OriginalDialog.tsx b/packages/client/src/components/OriginalDialog.tsx index 206cca87fe..8f59d690c3 100644 --- a/packages/client/src/components/OriginalDialog.tsx +++ b/packages/client/src/components/OriginalDialog.tsx @@ -78,7 +78,7 @@ const DialogContent = React.forwardRef< }, ref, ) => { - /* Handle Escape key to prevent closing dialog if a tooltip is open + /* Handle Escape key to prevent closing dialog if a tooltip or dropdown is open (this is a workaround in order to achieve WCAG compliance which requires that our tooltips be dismissable with Escape key) */ const handleEscapeKeyDown = React.useCallback( @@ -100,6 +100,22 @@ const DialogContent = React.forwardRef< } } + // Check if a dropdown menu is open + const dropdownMenus = document.querySelectorAll('[role="menu"]'); + for (const dropdown of Array.from(dropdownMenus)) { + const computedStyle = window.getComputedStyle(dropdown); + const opacity = parseFloat(computedStyle.opacity); + + if ( + computedStyle.display !== 'none' && + computedStyle.visibility !== 'hidden' && + opacity > 0 + ) { + event.preventDefault(); + return; + } + } + // Call the original handler if it exists propsOnEscapeKeyDown?.(event); }, From d4327173c765d08a986487053012e38ca52c8c06 Mon Sep 17 00:00:00 2001 From: Dustin Healy <54083382+dustinhealy@users.noreply.github.com> Date: Fri, 12 Dec 2025 15:19:55 -0800 Subject: [PATCH 2/2] refactor: simplify escapekeydown handler logic for tooltips and dropdown menus --- .../client/src/components/OriginalDialog.tsx | 37 ++++--------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/packages/client/src/components/OriginalDialog.tsx b/packages/client/src/components/OriginalDialog.tsx index 8f59d690c3..35b268dead 100644 --- a/packages/client/src/components/OriginalDialog.tsx +++ b/packages/client/src/components/OriginalDialog.tsx @@ -84,39 +84,18 @@ const DialogContent = React.forwardRef< const handleEscapeKeyDown = React.useCallback( (event: KeyboardEvent) => { const tooltips = document.querySelectorAll('.tooltip'); - - for (const tooltip of Array.from(tooltips)) { - const computedStyle = window.getComputedStyle(tooltip); - const opacity = parseFloat(computedStyle.opacity); - - if ( - tooltip.parentElement && - computedStyle.display !== 'none' && - computedStyle.visibility !== 'hidden' && - opacity > 0 - ) { - event.preventDefault(); - return; - } - } - - // Check if a dropdown menu is open const dropdownMenus = document.querySelectorAll('[role="menu"]'); - for (const dropdown of Array.from(dropdownMenus)) { - const computedStyle = window.getComputedStyle(dropdown); - const opacity = parseFloat(computedStyle.opacity); - if ( - computedStyle.display !== 'none' && - computedStyle.visibility !== 'hidden' && - opacity > 0 - ) { - event.preventDefault(); - return; - } + if (tooltips.length > 0) { + event.preventDefault(); + return; + } + + if (dropdownMenus.length > 0) { + event.preventDefault(); + return; } - // Call the original handler if it exists propsOnEscapeKeyDown?.(event); }, [propsOnEscapeKeyDown],