Skip to content

Fix keyboard navigation issues on menu #86

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 15, 2022
Merged

Fix keyboard navigation issues on menu #86

merged 2 commits into from
Jun 15, 2022

Conversation

geoffrich
Copy link
Member

Closes #85 and fixes some keyboard navigation issues I noticed.

  • the heading and next/prev buttons were directly after the toggle in the DOM order. This meant that once the menu opened, they received focus first behind the menu. I moved them after the menu so we don't have that issue
  • hide the menu using visibility: hidden so it doesn't receive focus when the menu is closed. I had to update the CSS transition to preserve the original slide in/out.
  • automatically close the menu when focus leaves using an action. this makes it so that after tabbing past the end of the menu, the menu automatically closes and focus is on the "next" link. Otherwise, it wouldn't be clear where focus landed. I wrapped the toggle + the menu in a div to enable this, otherwise opening the menu, tabbing to the search, and tabbing back would close the menu. This method was inspired by Andy Bell
  • apply focus styles to section toggles (folders don't have visible focus outline in menu #85)

- move menu directory after toggle in DOM order
- hide menu from keyboard with CSS when closed
- automatically close menu when focus leaves
- show focus on section toggles
@geoffrich geoffrich requested a review from Rich-Harris June 14, 2022 15:57
@vercel
Copy link

vercel bot commented Jun 14, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
learn-svelte-dev ✅ Ready (Inspect) Visit Preview Jun 14, 2022 at 3:58PM (UTC)

@Rich-Harris
Copy link
Member

wonderful, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

folders don't have visible focus outline in menu
2 participants