From dd04b2a400958359d7a76e9c5564adbfdf75a01a Mon Sep 17 00:00:00 2001 From: Fuwn Date: Fri, 15 May 2026 09:17:28 +0000 Subject: fix(a11y): make header Dropdown keyboard-operable Wire Enter/Space/ArrowDown/ArrowUp/Escape on the toggle and ArrowDown/ArrowUp/Home/End/Escape on each item so the Schedule and Profile menus are reachable without a mouse. Add aria-haspopup, aria-expanded, aria-controls, and role=menu/menuitem; give each instance a unique toggle/menu id so the two header dropdowns no longer collide. Close the menu on item activation so preventDefault items (e.g. Log Out) don't leave it hanging open. Focus moves via `await tick()` so :focus-visible matches reliably, with a scoped fallback outline tuned to var(--base0D) for the menu items. --- src/lib/Layout/Dropdown.svelte | 89 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 83 insertions(+), 6 deletions(-) (limited to 'src/lib/Layout') diff --git a/src/lib/Layout/Dropdown.svelte b/src/lib/Layout/Dropdown.svelte index d27b2590..be35acff 100644 --- a/src/lib/Layout/Dropdown.svelte +++ b/src/lib/Layout/Dropdown.svelte @@ -1,4 +1,6 @@ @@ -28,18 +88,20 @@ const handleClickOutside = (event: MouseEvent) => { };`} > { e.preventDefault(); open = !open; }} - onkeydown={(_e) => { - // if (e.key === 'Enter' || e.key === ' ') open = !open; - }} + onkeydown={handleToggleKey} role="button" tabindex="0" + aria-haspopup="menu" + aria-expanded={open} + aria-controls={menuId} > {#if title} {title} @@ -48,15 +110,24 @@ const handleClickOutside = (event: MouseEvent) => { {/if} -
- {#each items as item} +