-
Notifications
You must be signed in to change notification settings - Fork 4.5k
[Blocks]: Fix single block selection by holding shift
key
#34137
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
Conversation
Size Change: +2 B (0%) Total Size: 1.03 MB
ℹ️ View Unchanged
|
await page.keyboard.type( 'test' ); | ||
|
||
await saveDraft(); | ||
await page.reload(); |
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.
Why is saving and reloading needed?
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.
To start fresh with nothing selected. I guess I could alternatively click something outside the block editor..
@@ -165,7 +165,13 @@ export function useMultiSelection( clientId ) { | |||
|
|||
if ( event.shiftKey ) { | |||
const blockSelectionStart = getBlockSelectionStart(); | |||
if ( blockSelectionStart !== clientId ) { |
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.
If you hold shift and click on the same block, isn't this condition 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.
Exactly and that's why it thinks we are in multi selection mode. getBlockSelectionStart
is undefined
if we haven't selected a block. So my thinking was that we should check first if a block is selected.
Description
Fixes: #34118
If we have no block selected and select one by holding the
shift
key, it makes the block uneditable and there is no clear way to get it back to normal state.This happened because when holding
shift
and clicking a block, we assumed there is already a block selected. Currently if you follow the testing instructions the blocks are not editable. In this PR the block is just selected.Testing instructions
shift
key andclick
to a block (for example a paragraph which has richText support).