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

[Block Editor]: Fix shift+click on a child block with its parent selected #35988

Merged
merged 1 commit into from
Oct 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ export function useMultiSelection( clientId ) {
blockSelectionStart !== clientId &&
! startParents?.includes( clientId )
) {
toggleRichText( node, false );
const startPath = [
...startParents,
blockSelectionStart,
Expand All @@ -187,8 +186,15 @@ export function useMultiSelection( clientId ) {
];
const depth =
Math.min( startPath.length, endPath.length ) - 1;
multiSelect( startPath[ depth ], endPath[ depth ] );
event.preventDefault();
const start = startPath[ depth ];
const end = endPath[ depth ];
// Handle the case of having selected a parent block and
// then sfift+click on a child.
if ( start !== end ) {
toggleRichText( node, false );
multiSelect( start, end );
event.preventDefault();
}
}
} else if ( hasMultiSelection() ) {
// Allow user to escape out of a multi-selection to a
Expand Down