-
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
Escape as Select/Edit mode Toggle #58637
Conversation
Right now an Enter keypress moves from navigation mode into edit mode, and an Escape keypress resets focus back to the top of the document. It feels like a focus loss to me. This change makes an Escape keypress in navgation mode return to edit mode.
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core SVNIf you're a Core Committer, use this list when committing to
GitHub Merge commitsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
@andrewserong @alexstine - I know y'all have worked a lot on List View keyboard interactions. I want to make sure I'm not undoing anything here. |
Size Change: +597 B (0%) Total Size: 1.69 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the ping @jeryj, this feels great to me! It might be worth confirming with @alexstine, too.
✅ Escape key behaviour in the list view still allows deselecting blocks
✅ Escape key within the editor canvas (post and site editors) still allows deselecting multiple blocks
✅ When only a single block is selected in the editor canvas, Escape now allows toggling between select/edit
LGTM! ✨
Apologies, I forgot to check the failing tests before giving an approving review (the behaviour feels good to me, though, so I was excited to give it the ✅ 😄). Before landing, I think some of the e2e tests will need fixing up to reflect the new behaviour. For example it seems In the case of that test, it's still possible to select all blocks and delete them, it's just that I think that test expected to be able to go to no block selection by pressing the Escape key twice, which is no longer possible. That does feel good to me in practice, but will need to be reflected in the test (and likely confirm with @alexstine that it isn't a blocker if it's now harder to get to a state where no blocks are selected). |
Here's a visual that shows what Andrew outlined here: This is an excellent improvement for the writing flow. Thank you 🙏 |
Flaky tests detected in 073ae19. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7787907482
|
In the editor, escape is a shortcut to switch to Select/Navigation mode , and then another Escape keypress resets selection to the top of the DOM. This always surprises me, and feels like a focus loss as I can't see where the focus is anymore. I like @jasmussen's recommendation to turn Escape into a toggle between Select/Edit modes
What?
Use Escape as a toggle between Edit and Select modes.
Why?
To have a more predictable experience. Escape doing two things (switching to select mode, then moving focus to the top of the DOM feels really off to me).
How?
Add an isEscape check to the top of the onKeydown for the breadcrumb. This makes it operate very similarly to the Enter keypress to switch to Edit mode.
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast