fix(web): inert the collapsed sidebar so off-screen nav leaves the a11y tree (BUG-2282) (#1011)

The mobile sidebar drawer collapses via translateX + pointer-events:none but
stayed in the accessibility tree and tab order, so a screen-reader virtual
cursor and keyboard Tab still reached its off-screen nav links. Bind `inert` to
the same !sidebarOpen condition that drives the collapse class + the existing
pointer-events:none rule, so a collapsed drawer leaves both the a11y tree and
the focus order — covering the mobile drawer and the latent desktop width:0
collapse. The re-open control lives in TopBar (outside the aside) so nothing is
trapped; swipe-to-open is a window handler, unaffected.

Claude-Session: https://claude.ai/code/session_01EZ6yr6pAUFb1uffan912ra
This commit is contained in:
xarmian
2026-07-22 23:57:39 -04:00
committed by GitHub
parent e2ec876be9
commit ccf7dafe9e
@@ -390,10 +390,20 @@
<div class="backdrop" onclick={() => uiStore.closeSidebar()}></div>
{/if}
<!--
BUG-2282: collapsed = off-screen/hidden (mobile drawer slid out via
translateX; desktop width:0). `pointer-events:none` (see .sidebar.collapsed)
blocks the mouse but leaves the nav in the a11y tree + tab order — an SR
virtual cursor / Tab reaches off-screen links. `inert` removes it from both,
matching the same collapsed condition. Safe: the re-open control lives in
TopBar (outside the aside), so this never traps the user; swipe-to-open is a
window handler, not on the aside.
-->
<aside
class="sidebar"
class:collapsed={!uiStore.sidebarOpen}
class:mobile={uiStore.isMobile}
inert={!uiStore.sidebarOpen}
bind:this={sidebarEl}
ontouchstart={handleTouchStart}
ontouchmove={handleTouchMove}