🚧 Work in progress 🚧
Live demo: https://svelte-floating-ui-a11y-menu.vercel.app/
npm install
npm run dev -- --open
npm run storybook
(not compatible yet) https://storybook.js.org/addons/@storybook/addon-svelte-csf
Add focus styles for mobile menu
Improve focus styles
Add escape key for mobile dialog overlay
Add current active link and mark it with aria-current=
Add focus trap for mobile menu overlay (https://www.npmjs.com/package/svelte-focus-trap ?)
Use all keyboard events (arrow up, down) of https://w3c.github.io/aria-practices/examples/disclosure/disclosure-navigation.html
Integrate Example Disclosure Navigation Menu with Top-Level Links
Check if Floating UI autoUpdater was written reliable and dumps all old listeners / switch to Svelte solution for resize / scrolling detection?
Bonus: Handle all resize cases and hide menus if menus switch between mobile & desktop?
Read https://adrianroselli.com/2019/06/link-disclosure-widget-navigation.html
Fix contrast errors
Test with screenreaders!
Get feedback by a11y experts!
I did not use {#if activeMenu == 'news'}
around <ul>
-submenus, because this removes submenus temporarily completely from DOM. I wasn't sure if this was okay with aria-controls= references (https://stackoverflow.com/a/73391142). Drawback is, that you can't use Svelte animations like in:fly={{ y: -10 }}
on these submenus.
Instead I used a .hide
-class (provided by Foxeye.Rinx), this does not remove elements from DOM. See feat: svelte-display directive #6336 #7932 for more details.
touchstart
events to not trigger click events as well https://web.dev/mobile-touchandmouse/npm create svelte@latest .
npm install @floating-ui/dom
npm i @picocss/pico sass svelte-preprocess