Skip to content

Commit d82614c

Browse files
Mamadukatyxla
andauthored
Block Editor: Fix single block selection when holding 'Shift' key (#70978)
Co-authored-by: Mamaduka <[email protected]> Co-authored-by: tyxla <[email protected]>
1 parent f901f00 commit d82614c

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

packages/block-editor/src/components/writing-flow/use-click-selection.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ export default function useClickSelection() {
2727
const clickedClientId = getBlockClientId( event.target );
2828

2929
if ( event.shiftKey ) {
30-
if ( startClientId !== clickedClientId ) {
30+
// When selecting a single block in a document by holding the shift key,
31+
// don't mark this action as multiselection.
32+
if ( startClientId && startClientId !== clickedClientId ) {
3133
node.contentEditable = true;
3234
// Firefox doesn't automatically move focus.
3335
node.focus();

test/e2e/specs/editor/various/multi-block-selection.spec.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -291,20 +291,15 @@ test.describe( 'Multi-block selection (@firefox, @webkit)', () => {
291291
editor,
292292
pageUtils,
293293
} ) => {
294-
// To do: run with iframe.
295-
await editor.switchToLegacyCanvas();
296-
297294
await editor.insertBlock( {
298295
name: 'core/paragraph',
299296
attributes: { content: 'test' },
300297
} );
301298

302299
await editor.saveDraft();
303300
await page.reload();
304-
// To do: run with iframe.
305-
await editor.switchToLegacyCanvas();
306301

307-
await page
302+
await editor.canvas
308303
.getByRole( 'document', { name: 'Block: Paragraph' } )
309304
.click( { modifiers: [ 'Shift' ] } );
310305
await pageUtils.pressKeys( 'primary+a' );

0 commit comments

Comments
 (0)