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

drivers/js: focus management on page change #3

Closed
atdiar opened this issue May 10, 2022 · 2 comments
Closed

drivers/js: focus management on page change #3

atdiar opened this issue May 10, 2022 · 2 comments
Labels
drivers/js javascript backend help wanted Extra attention is needed

Comments

@atdiar
Copy link
Owner

atdiar commented May 10, 2022

Problem statement

Contrary to a MPA generated on the server, an SPA does not need to reload for changes to be displayed on the page.
This is a problem for accessibility (a11y) since changes might not be announced/visible to screen readers etc.
One way to deal with this is to change the active element (element in focus).

Basically, a SPA can be seen as a composition/nesting of dynamic elements (outlets). Each outlet essentially defines a nested body. Either it is focusable itself or it has a focusable element.
If none applies, we can look at its parent.

That could be the element that captures focus on change, similarly to body in a MPA?

The point is to handle things such as tabbed lists gracefully. Moving the focus to the very begining is likely to be too cumbersome. As the name indicates, focus determines the locality of the user-intent, area of change.

In a sense, the identity of the currently focused element is a property of the UI state that should be recoverable between navigations. If MPA do not persist UI state by default, we have here the opportunity to do it.

We should also be able to deal with error mode where the focused item disappears in-between navigation. In that case, where should the focus go? to the closest focusable parent element?

Ref.

https://www.gatsbyjs.com/blog/2019-07-11-user-testing-accessible-client-routing/
https://a11y-guidelines.orange.com/en/articles/single-page-app/
http://web-accessibility.carnegiemuseums.org/code/skip-link/#content

@atdiar atdiar added help wanted Extra attention is needed drivers/js javascript backend labels May 10, 2022
@atdiar
Copy link
Owner Author

atdiar commented Aug 1, 2022

Mostly implemented. Just have to make sure that the div that holds the aria-announcer is not visually visible.

@atdiar
Copy link
Owner Author

atdiar commented Aug 17, 2022

It's working now.

@atdiar atdiar closed this as completed Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
drivers/js javascript backend help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant