From 671ecabc4115b994dc31d14dea5248f925f04cb1 Mon Sep 17 00:00:00 2001 From: xarmian Date: Sun, 10 May 2026 16:15:01 -0400 Subject: [PATCH] fix(console): mobile hamburger toggles correctly on tap (BUG-1330) (#480) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The /console mobile hamburger button never opened its dropdown on tap. A tap on the closed-state SVG inside the button triggered the toggle's onclick (`mobileMenuOpen = true`), but Svelte 5 then synced the {#if mobileMenuOpen}{:else}{/if} swap *before* the bubbled `` listener ran. By that point the original `` click target was detached from the DOM (`event.target.isConnected === false`); `target.closest('.console-nav')` walked an orphaned subtree and returned null, the outside-click branch fired, and the menu was reset to closed in the same tick — visually "never opened." Verified the timing in a Svelte 5 playground that mirrors the pattern; the window handler logged `target=rect, isConnected=false, closest(.nav)=NULL` for every tap. Two-layer fix in web/src/routes/console/+layout.svelte: 1. Add `pointer-events: none` to `.mobile-hamburger svg` and its children so the click target is always the button itself, which is never re-rendered/detached when `mobileMenuOpen` flips. This is the primary fix and matches the standard "icons inside buttons should not capture pointer events" pattern. 2. Stop propagation on the toggle button's onclick so the click cannot reach `handleWindowClick` even if a future change adds an inner element without the same guard. Belt-and-braces. Inline comments record the BUG-1330 root cause so the next person to touch this nav doesn't reintroduce the SVG-swap. TopBar.svelte's mobile hamburger is unaffected — its SVG content doesn't swap on toggle (same icon regardless of sidebar state), so the detach race never fires there. --- web/src/routes/console/+layout.svelte | 32 ++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/web/src/routes/console/+layout.svelte b/web/src/routes/console/+layout.svelte index 64c4d109..b44312a0 100644 --- a/web/src/routes/console/+layout.svelte +++ b/web/src/routes/console/+layout.svelte @@ -76,9 +76,19 @@