Skip to content

Commit

Permalink
If select-all fires in .editor-post-title__input, end the process.. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
torounit authored and desrosj committed Aug 30, 2021
1 parent d9c56de commit 455de81
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ export default function useSelectAll() {
return;
}

if (
event.target.classList.contains( 'editor-post-title__input' )
) {
return;
}

const selectedClientIds = getSelectedBlockClientIds();

if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -659,4 +659,20 @@ describe( 'Multi-block selection', () => {
// Expect both paragraphs to be deleted.
expect( await getEditedPostContent() ).toMatchSnapshot();
} );

it( 'should select title if the cursor is on title', async () => {
await clickBlockAppender();

await page.keyboard.type( '1' );
await page.keyboard.press( 'Enter' );
await page.keyboard.type( '2' );

await page.type( '.editor-post-title__input', 'Post title' );

await pressKeyWithModifier( 'primary', 'a' );
const selectedText = await page.evaluate( () => {
return window.getSelection().toString();
} );
expect( selectedText ).toEqual( 'Post title' );
} );
} );

0 comments on commit 455de81

Please sign in to comment.