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

List View: Block selection (and focus transfer) works inconsistently based on whether a block is selected #66276

Open
2 tasks done
talldan opened this issue Oct 21, 2024 · 2 comments
Labels
[Feature] List View Menu item in the top toolbar to select blocks from a list of links. [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Type] Bug An existing feature does not function as intended

Comments

@talldan
Copy link
Contributor

talldan commented Oct 21, 2024

Description

List View serves as an important accessibility tool, users can jump into List View using a shortcut, navigate blocks using arrow keys and usually jump back to a block in the canvas by selecting it in List View.

There's one case where this doesn't quite work - if a block is already selected, if you try selecting it again focus doesn't transfer to the canvas.

The semantics in List View don't really tell you this wouldn't work, all the block items are links to the blocks in the canvas.

The best outcome seems to be making sure this works and focus is transferred.

Step-by-step reproduction instructions

  1. Create a new post and add a few paragraph blocks
  2. Press Ctrl+Opt+O (on Mac) or Alt+Shift+O (on Windows/Linux) to open List View and note that the select block is focused in List View
  3. Navigate to another block and select it using Enter or Space, note that it moves focus back to the canvas
  4. Open List View again (Ctrl+Opt+O or Alt+Shift+O)
  5. Try selecting the already selected block using Enter or Space
  6. Observe that focus isn't moved.

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes
@talldan talldan added [Feature] List View Menu item in the top toolbar to select blocks from a list of links. [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Type] Bug An existing feature does not function as intended labels Oct 21, 2024
@draganescu
Copy link
Contributor

draganescu commented Oct 30, 2024

The focus is transfered when selection changes. But, since the selected block does not change when we select the selected block in the list view, there is no selection change. Therefore no focus transfer.

Also for partially synced patterns the list view only sends focus to the editable blocks if the parent pattern is previously selected, this looks like a separate issue.

@talldan
Copy link
Contributor Author

talldan commented Nov 7, 2024

The focus is transfered when selection changes. But, since the selected block does not change when we select the selected block in the list view, there is no selection change. Therefore no focus transfer.

Thanks for looking into it. I think that's a good summary of the issue. IIRC, the code that handles the focus is quite decoupled from the action that triggers block selection, so it isn't an easy problem to solve.

Also for partially synced patterns the list view only sends focus to the editable blocks if the parent pattern is previously selected, this looks like a separate issue.

I couldn't reproduce that on latest trunk. I think there might have been some experimentation with sending focus to the first contentOnly block when the parent is selected in the canvas, so maybe that leaked into the list view implementation too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] List View Menu item in the top toolbar to select blocks from a list of links. [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

2 participants