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: Impossible to deselect all blocks using the keyboard #48462

Closed
alexstine opened this issue Feb 26, 2023 · 5 comments · Fixed by #48708
Closed

List view: Impossible to deselect all blocks using the keyboard #48462

alexstine opened this issue Feb 26, 2023 · 5 comments · Fixed by #48708
Assignees
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). [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@alexstine
Copy link
Contributor

Description

It is impossible to deselect all blocks using the keyboard only. If you select some blocks, there is no way to remove your selection. I would expect this to not be the case.

Step-by-step reproduction instructions

  1. Open the editor and insert 5 blocks.
  2. Open the list view.
  3. Navigate to the 2nd block in the list view.
  4. Press shift+down arrow.
  5. Press shift+up arrow.
  6. Notice how there are still blocks selected indicated by the live region at the bottom of the page.
  7. There should be a way to deselect all blocks without selecting the 1st block causing the selection to go to 2 again.

Screenshots, screen recording, code snippet

No response

Environment info

Browser: Firefox (110.0)
WordPress: 6.2-alpha-54678
Gutenberg: trunk

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

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

@andrewserong I cannot understand the math logic in the selection hook for the list view. Hopefully you can figure this out.

Thanks.

@andrewserong
Copy link
Contributor

Thanks for the ping! This is a tricky one because when a single block is selected, we can't know if the user expects that shift-selecting in the opposite direction will deselect all blocks, or if they intend to move the selection to include the previous block. It seems that the current behaviour follows how things work in a file system, where if a single block is selected, shift-selecting to another block will expand the selection. However, in a file system, the currently focused item is always selected, so there isn't the concept we have with the list view, where there's a difference between a focused item and a selected item.

Would it work to have another keyboard shortcut for explicitly deselecting blocks? My first thought is what if the Escape key could allow the user to deselect all blocks, however that then causes an issue if they intended to close the list view without changing the selection. We could also potentially create a new keyboard shortcut, for example shift-escape or something like that...

Do you have an idea in mind about how this should ideally work? Happy to help out if we can come up with a good direction to play with.

@alexstine
Copy link
Contributor Author

@andrewserong I am okay with escape here I think, we just need to make sure it does not close the list view if there are selected blocks. Is that possible? I think screen readers will not switch modes due to the application role.

@andrewserong
Copy link
Contributor

we just need to make sure it does not close the list view if there are selected blocks. Is that possible?

I think it should be possible to prioritise deselecting blocks when the Escape key is initially pressed, and skip closing the list view if there was a selection, but I haven't looked closely at it. I can have a play with it this week!

@andrewserong
Copy link
Contributor

I've started a draft over in #48708 to explore a solution for this using the Escape key as discussed.

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). [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants