Site editor: rethink where initial focus lands #69490
Labels
[Feature] Site Editor
Related to the overarching Site Editor (formerly "full site editing")
[Focus] Accessibility (a11y)
Changes that impact accessibility and need corresponding review (e.g. markup changes).
[Status] In Progress
Tracking issues with work in progress
[Type] Bug
An existing feature does not function as intended
Description
Splitting this out from #57400 (comment)
Setting initial focus on a specific place in any UI should only be done when there's a very, unique, specific flow users haev to follos so that establishing a 'starting point' makes sense based on that flow.
In all other cases, where there's no unique, specific, flow users can take the best option is to not set initial focus and just let the Tab order start from the document root. This also helps discoverability and consistency as users start navigating the UI from the beginning and they're not forced to 'skip' important parts that live before any place where initial focus may be set.
Currently, in the Site Editor when switching from 'view' to 'edit' mode, initial focus appears to go to the editor canvas. Actually, focus is already on the editor canvas iframe. It just stays there but other parts of the UI are now rendered before the iframe.
That happens because in 'preview' mode, the preview only shows the iframe, which has an ARIA
role="button"
and a labelEdit
. When the iframe is focused and after pressing the Enter key, the editor switches to 'edit mode. Focus just stays on the iframe but now the entire top bar is rendered before it. From a keyboard accessibility perspective this is equivalent to setting initial focus to a place that doesn't make much sense and that skips important parts of the UI. This current behavior assumes users have to start their flow in the editor canvas, which isn't necessarily true.Rather after the editor switches to edit mode, focus should normally start from the document root.
The current behavior is also inconsistent with the initial focus in the Post editor, where the Tab sequence normally starts from the document root. Sooner or later the two editors will be unified so that having a consistent, expected, focus behavior should be implemented anyways.
Video to illustrate. Observe that after the editor switches to edit mode:
Screen.Recording.2025-03-07.at.14.19.15.mov
Ideally, focus should be naturally reset bt I'm not sure that can be done in any way other than using an explicit
blur()
so that it starts from teh document root and the first Tab key press will focus the 'Open navigation' button at the top left.Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Please confirm which theme type you used for testing.
The text was updated successfully, but these errors were encountered: