Skip to content

Commit

Permalink
[Block Editor]: Fix shift+click on a child block with its parent sele…
Browse files Browse the repository at this point in the history
…cted (#35988)
  • Loading branch information
ntsekouras committed Oct 27, 2021
1 parent 70ee670 commit 5d6c41c
Showing 1 changed file with 9 additions and 3 deletions.
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

0 comments on commit 5d6c41c

Please sign in to comment.