From 032600f91d370992a5ef32c96d0e6ed5ce0f790b Mon Sep 17 00:00:00 2001 From: Autumn Valenta Date: Tue, 7 May 2024 23:04:50 -0600 Subject: [PATCH] Dismiss menu on Cancel when at top level --- src/components/DisplayMenu.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/DisplayMenu.jsx b/src/components/DisplayMenu.jsx index c27d9e9..5a63e9c 100644 --- a/src/components/DisplayMenu.jsx +++ b/src/components/DisplayMenu.jsx @@ -137,7 +137,10 @@ export default function DisplayMenu({ const keyHandler = (e) => { if (e.key === keyMap.cancel) { setMenus((menus) => { - if (menus.length > 1) { + if (menus[0].autoStart || menus.length === 1) { + window.dispatchEvent(new CustomEvent('interaction', { detail: null })); + return []; + } else if (menus.length > 1) { const newMenus = menus.slice(0, -1); setSelected(newMenus[newMenus.length - 1].selected); return newMenus;