From 7fdfe0d9a5623cc466d8ac64ddded74198e46a22 Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Thu, 25 May 2023 13:28:53 +0100 Subject: [PATCH 1/5] Reinstate Text control outside of settings --- .../src/components/link-control/index.js | 40 +++++++++---------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/packages/block-editor/src/components/link-control/index.js b/packages/block-editor/src/components/link-control/index.js index b90f6d245d9539..71cb6815e264a5 100644 --- a/packages/block-editor/src/components/link-control/index.js +++ b/packages/block-editor/src/components/link-control/index.js @@ -347,6 +347,17 @@ function LinkControl( { } useLabel={ showTextControl } /> + { showTextControl && ( + + ) } { errorMessage && ( - { ( showSettings || showTextControl ) && ( + { showSettings && ( - { showTextControl && ( - - ) } - { showSettings && ( - - ) } + ) } From 034680d9fb1dafa65bad746f0da08c7b36be54b3 Mon Sep 17 00:00:00 2001 From: MaggieCabrera Date: Tue, 30 May 2023 10:14:24 +0200 Subject: [PATCH 2/5] change selector on tests --- packages/e2e-tests/specs/editor/various/links.test.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/e2e-tests/specs/editor/various/links.test.js b/packages/e2e-tests/specs/editor/various/links.test.js index 880f786bd4cbe7..13ae8b204a8ce8 100644 --- a/packages/e2e-tests/specs/editor/various/links.test.js +++ b/packages/e2e-tests/specs/editor/various/links.test.js @@ -18,7 +18,10 @@ describe( 'Links', () => { const waitForURLFieldAutoFocus = async () => { await page.waitForFunction( - () => !! document.activeElement.closest( '.block-editor-url-input' ) + () => + !! document.activeElement.closest( + '.block-editor-url-input__input' + ) ); }; From 3b39e93024d0ae89fd881b30f8de45e6df960ccf Mon Sep 17 00:00:00 2001 From: MaggieCabrera Date: Tue, 30 May 2023 11:43:47 +0200 Subject: [PATCH 3/5] fix playwright test --- test/e2e/specs/editor/blocks/links.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/specs/editor/blocks/links.spec.js b/test/e2e/specs/editor/blocks/links.spec.js index 208aca3b6e5b37..6493b9effe8aab 100644 --- a/test/e2e/specs/editor/blocks/links.spec.js +++ b/test/e2e/specs/editor/blocks/links.spec.js @@ -103,7 +103,7 @@ test.describe( 'Links', () => { // Edit link. await pageUtils.pressKeys( 'primary+k' ); - await pageUtils.pressKeys( 'primary+a' ); + await page.getByPlaceholder( 'Search or type url' ).fill( '' ); await page.keyboard.type( 'wordpress.org' ); // Update the link. From 0721bb9ac5a26fa8d4a5eebdf84361ad70bd768e Mon Sep 17 00:00:00 2001 From: MaggieCabrera Date: Tue, 30 May 2023 12:57:45 +0200 Subject: [PATCH 4/5] fix the waitForFunction function on the tests --- .../e2e-tests/specs/editor/various/links.test.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/e2e-tests/specs/editor/various/links.test.js b/packages/e2e-tests/specs/editor/various/links.test.js index 13ae8b204a8ce8..2573ea94df6862 100644 --- a/packages/e2e-tests/specs/editor/various/links.test.js +++ b/packages/e2e-tests/specs/editor/various/links.test.js @@ -17,12 +17,16 @@ describe( 'Links', () => { } ); const waitForURLFieldAutoFocus = async () => { - await page.waitForFunction( - () => - !! document.activeElement.closest( - '.block-editor-url-input__input' - ) - ); + await page.waitForFunction( () => { + const input = document.querySelector( + '.block-editor-url-input__input' + ); + if ( input ) { + input.focus(); + return true; + } + return false; + } ); }; it( 'will use Post title as link text if link to existing post is created without any text selected', async () => { From 68e20549fda592e050e5f35593fb6e750d4ecb09 Mon Sep 17 00:00:00 2001 From: MaggieCabrera Date: Tue, 30 May 2023 13:48:44 +0200 Subject: [PATCH 5/5] fix e2e tests --- .../specs/editor/various/links.test.js | 30 ++----------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/packages/e2e-tests/specs/editor/various/links.test.js b/packages/e2e-tests/specs/editor/various/links.test.js index 2573ea94df6862..fdcb7c5f793ade 100644 --- a/packages/e2e-tests/specs/editor/various/links.test.js +++ b/packages/e2e-tests/specs/editor/various/links.test.js @@ -527,11 +527,6 @@ describe( 'Links', () => { await waitForURLFieldAutoFocus(); - const [ settingsToggle ] = await page.$x( - '//button[contains(@aria-label, "Link Settings")]' - ); - await settingsToggle.click(); - await page.keyboard.press( 'Tab' ); // Tabbing should land us in the text input. @@ -589,15 +584,6 @@ describe( 'Links', () => { await editButton.click(); - await waitForURLFieldAutoFocus(); - - const [ settingsToggle ] = await page.$x( - '//button[contains(@aria-label, "Link Settings")]' - ); - await settingsToggle.click(); - - await page.keyboard.press( 'Tab' ); - // Tabbing back should land us in the text input. const textInputValue = await page.evaluate( () => document.activeElement.value @@ -624,14 +610,6 @@ describe( 'Links', () => { '//button[contains(@aria-label, "Edit")]' ); await editButton.click(); - await waitForURLFieldAutoFocus(); - - const [ settingsToggle ] = await page.$x( - '//button[contains(@aria-label, "Link Settings")]' - ); - await settingsToggle.click(); - - await page.keyboard.press( 'Tab' ); // Tabbing should land us in the text input. const textInputValue = await page.evaluate( @@ -686,7 +664,7 @@ describe( 'Links', () => { await page.waitForXPath( `//label[text()='Open in new tab']` ); // Move focus back to RichText for the underlying link. - await pressKeyTimes( 'Tab', 4 ); + await pressKeyTimes( 'Tab', 3 ); // Make a selection within the RichText. await pressKeyWithModifier( 'shift', 'ArrowRight' ); @@ -694,7 +672,7 @@ describe( 'Links', () => { await pressKeyWithModifier( 'shift', 'ArrowRight' ); // Move back to the text input. - await pressKeyTimes( 'Tab', 3 ); + await pressKeyTimes( 'Tab', 2 ); // Tabbing back should land us in the text input. const textInputValue = await page.evaluate( @@ -894,10 +872,6 @@ describe( 'Links', () => { await waitForURLFieldAutoFocus(); - // Link settings open - await page.keyboard.press( 'Tab' ); - await page.keyboard.press( 'Space' ); - // Move to Link Text field. await page.keyboard.press( 'Tab' );