Skip to content
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

Routing accessibility #150

Open
Jonesus opened this issue Jun 28, 2023 · 1 comment
Open

Routing accessibility #150

Jonesus opened this issue Jun 28, 2023 · 1 comment
Labels
client Related to the client app only

Comments

@Jonesus
Copy link
Contributor

Jonesus commented Jun 28, 2023

Background

AFAIK, the current client app doesn't manage focus nor do page change announcements when navigating between pages, both of which would be quite essential for keyboard and low/no-vision accessibility. We should thus have some way to:

  1. Move the current focus to page root whenever navigation happens
  2. Announce to screen readers that the user has navigated to a new page
  3. Make using these as easy as possible (or omitting them as hard as possible 😉 )

Discussion on including these features in react-router
remix-run/react-router#9555

User research report on accessible SPA routing:
https://www.gatsbyjs.com/blog/2019-07-11-user-testing-accessible-client-routing/

Suggestion

  1. Wrap the whole application in a <div tabIndex={-1} id="focus-root" />
  2. Add a sibling element to #focus-root: <div aria-live="polite" id="navigation-announcement" />
  3. Add logic to useDocumentTitle(newTitle)
    • When this hook is called, move focus to #focus-root
    • Replace the text content of #navigation-announcement with the newTitle (perhaps with some prefix like "Navigated to ...", this should be tested to figure out what's reasonable)
  4. Include a skip link element as the first element in tab order after #focus-root
    • This should move focus to main content (main landmark) after any navigation
    • A reasonable default would most likely be the Content element of PageLayout.tsx
  5. Test to ensure that these things actually work as they do in my mind 😄

With this implementation we would get accessible routing behavior with the only requirement for the developer being that they remember to useDocumentTitle, which should be quite easy and natural

@Jonesus Jonesus added the client Related to the client app only label Jun 28, 2023
@Temzasse
Copy link
Contributor

Great idea! 💯👌

I wonder if the implementation should be instead baked into the route entry utils since using the document title hook doesn't always tie into a page navigation 🤔 I can give a tour of the current route entry pattern and we can think how to best incorporate the a11y stuff to it. If you wanna dive head first into it you can take a look at the /routes/route-utils file 😄

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

No branches or pull requests

2 participants