Open Jonesus opened 1 year ago
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 😄
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:
Discussion on including these features in
react-router
https://github.com/remix-run/react-router/discussions/9555User research report on accessible SPA routing: https://www.gatsbyjs.com/blog/2019-07-11-user-testing-accessible-client-routing/
Suggestion
<div tabIndex={-1} id="focus-root" />
#focus-root
:<div aria-live="polite" id="navigation-announcement" />
useDocumentTitle(newTitle)
#focus-root
#navigation-announcement
with thenewTitle
(perhaps with some prefix like "Navigated to ...", this should be tested to figure out what's reasonable)#focus-root
Content
element ofPageLayout.tsx
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