-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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: Unify shortcut handlers #61130
Conversation
Size Change: +249 B (0%) Total Size: 1.75 MB
ℹ️ View Unchanged
|
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 If 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. |
setOpenedBlockSettingsMenu( undefined ); | ||
updateFocusAndSelection( newlySelectedBlocks[ 0 ], false ); |
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.
It is odd that we have to use setOpenedBlockSettingsMenu
to ensure the dropdown is closed after the action. One would think that moving focus to the List View item would handle that.
P.S. The issue isn't consistently reproducible manually but failed in e2e tests.
|
||
// If multiple blocks are selected, deselect all blocks when the user | ||
// presses the escape key. | ||
if ( event.keyCode === ESCAPE && selectedClientIds.length > 0 ) { |
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.
This needs to be converted to a core/block-editor/unselect
event, and there's no need to trigger an event when only one block is selected.
I'll create a follow-up PR for this.
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.
Here's the follow-up #61223. I left the block count check after realizing that List View allows deselecting a single block.
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.
LGTM 👍! It also works when the focus is in the menu dropdown 💯. Thank you 🙇
What?
PR removes special List View shortcut handling (introduced in #50422) from the
BlockSettingsDropdown
component. Now, all the list view shortcuts are handled in a single place.Why?
It matches how the block shortcuts are handled in the canvas.
How?
PR moves the shortcut handlers from the
ListViewBlockSelectButton
to theListViewBlock
component. This way, events propagated from the popover are also captured.It's better to review with whitespace hidden - https://github.com/WordPress/gutenberg/pull/61130/files?diff=unified&w=1
Testing Instructions
Testing Instructions for Keyboard
Same.
Screenshots or screencast
CleanShot.2024-04-26.at.12.51.00.mp4