-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Comments
@andrewserong I cannot understand the math logic in the selection hook for the list view. Hopefully you can figure this out. Thanks. |
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. |
@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. |
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! |
I've started a draft over in #48708 to explore a solution for this using the Escape key as discussed. |
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
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
The text was updated successfully, but these errors were encountered: