From e06d38df4d9bf5941d0be364c5f0164d6c028155 Mon Sep 17 00:00:00 2001 From: Aki Hamano Date: Mon, 23 Mar 2026 17:51:04 +0900 Subject: [PATCH 1/7] Connectors: Improve AI plugin button --- package-lock.json | 3 +- routes/connectors-home/ai-plugin-callout.tsx | 41 +++++++------------- routes/connectors-home/package.json | 3 +- test/e2e/specs/admin/connectors.spec.js | 2 +- 4 files changed, 18 insertions(+), 31 deletions(-) diff --git a/package-lock.json b/package-lock.json index adc99623078299..206421817b83ff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -62956,7 +62956,8 @@ "@wordpress/element": "file:../../packages/element", "@wordpress/i18n": "file:../../packages/i18n", "@wordpress/icons": "file:../../packages/icons", - "@wordpress/ui": "file:../../packages/ui" + "@wordpress/ui": "file:../../packages/ui", + "@wordpress/url": "file:../../packages/url" } }, "routes/content-guidelines": { diff --git a/routes/connectors-home/ai-plugin-callout.tsx b/routes/connectors-home/ai-plugin-callout.tsx index faf5775ece40a0..a0ea1d74822d1a 100644 --- a/routes/connectors-home/ai-plugin-callout.tsx +++ b/routes/connectors-home/ai-plugin-callout.tsx @@ -5,13 +5,9 @@ import { speak } from '@wordpress/a11y'; import { Button, ExternalLink } from '@wordpress/components'; import { store as coreStore } from '@wordpress/core-data'; import { useSelect, useDispatch } from '@wordpress/data'; -import { - createInterpolateElement, - useEffect, - useRef, - useState, -} from '@wordpress/element'; +import { createInterpolateElement, useRef, useState } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; +import { addQueryArgs } from '@wordpress/url'; /** * Internal dependencies @@ -39,14 +35,6 @@ for ( const c of connectorDataValues ) { export function AiPluginCallout() { const [ isBusy, setIsBusy ] = useState( false ); const [ justActivated, setJustActivated ] = useState( false ); - const actionButtonRef = useRef< HTMLButtonElement >( null ); - - // Restore focus to the button after install/activate completes. - useEffect( () => { - if ( justActivated ) { - actionButtonRef.current?.focus(); - } - }, [ justActivated ] ); // Server-side initial state — true if any provider was already connected at page load. const initialHasConnectedProvider = useRef( @@ -218,7 +206,7 @@ export function AiPluginCallout() { return { label: isBusy ? __( 'Installing…' ) - : __( 'Install AI Experiments' ), + : __( 'Install the AI plugin' ), disabled: isBusy, onClick: isBusy ? undefined : installPlugin, }; @@ -227,7 +215,7 @@ export function AiPluginCallout() { return { label: isBusy ? __( 'Activating…' ) - : __( 'Activate AI Experiments' ), + : __( 'Activate the AI plugin' ), disabled: isBusy, onClick: isBusy ? undefined : activatePlugin, }; @@ -244,7 +232,6 @@ export function AiPluginCallout() {
{ showInstallActivate ? ( - ) + ) } { __( 'Learn more' ) } diff --git a/routes/connectors-home/package.json b/routes/connectors-home/package.json index 16496bff3ba523..3d258a488b7f1f 100644 --- a/routes/connectors-home/package.json +++ b/routes/connectors-home/package.json @@ -19,6 +19,7 @@ "@wordpress/element": "file:../../packages/element", "@wordpress/i18n": "file:../../packages/i18n", "@wordpress/icons": "file:../../packages/icons", - "@wordpress/ui": "file:../../packages/ui" + "@wordpress/ui": "file:../../packages/ui", + "@wordpress/url": "file:../../packages/url" } } diff --git a/test/e2e/specs/admin/connectors.spec.js b/test/e2e/specs/admin/connectors.spec.js index c345046b02367c..802b999aa3d581 100644 --- a/test/e2e/specs/admin/connectors.spec.js +++ b/test/e2e/specs/admin/connectors.spec.js @@ -390,7 +390,7 @@ test.describe( 'Connectors', () => { // Verify the Install button is present. await expect( - banner.getByRole( 'button', { name: 'Install AI Experiments' } ) + banner.getByRole( 'button', { name: 'Install the AI plugin' } ) ).toBeVisible(); // Verify the Learn more link is present. From ec6cd7b826464fdd6a58a78c96433481d99b9297 Mon Sep 17 00:00:00 2001 From: Aki Hamano Date: Mon, 23 Mar 2026 18:11:31 +0900 Subject: [PATCH 2/7] Move learn more link --- routes/connectors-home/ai-plugin-callout.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/routes/connectors-home/ai-plugin-callout.tsx b/routes/connectors-home/ai-plugin-callout.tsx index a0ea1d74822d1a..70a9e372549b83 100644 --- a/routes/connectors-home/ai-plugin-callout.tsx +++ b/routes/connectors-home/ai-plugin-callout.tsx @@ -188,16 +188,16 @@ export function AiPluginCallout() { const getMessage = () => { if ( isJustConnected ) { return __( - 'The AI plugin is ready to use. You can use it to generate featured images, alt text, titles, excerpts and more.' + 'The AI plugin is ready to use. You can use it to generate featured images, alt text, titles, excerpts and more. Learn more' ); } if ( isActiveNoProvider ) { return __( - 'The AI plugin is installed. Connect a provider below to generate featured images, alt text, titles, excerpts, and more.' + 'The AI plugin is installed. Connect a provider below to generate featured images, alt text, titles, excerpts, and more. Learn more' ); } return __( - 'The AI plugin can use your connectors to generate featured images, alt text, titles, excerpts and more.' + 'The AI plugin can use your connectors to generate featured images, alt text, titles, excerpts and more. Learn more' ); }; @@ -227,6 +227,11 @@ export function AiPluginCallout() {

{ createInterpolateElement( getMessage(), { strong: , + a: ( + + { __( 'Learn more' ) } + + ), } ) }

@@ -252,9 +257,6 @@ export function AiPluginCallout() { { __( 'Enable features in the AI plugin' ) } ) } - - { __( 'Learn more' ) } -
From d26ec606ecac6b23d254f2f2e7599d35aadfaf86 Mon Sep 17 00:00:00 2001 From: Aki Hamano Date: Mon, 23 Mar 2026 18:22:29 +0900 Subject: [PATCH 3/7] Restore effect --- routes/connectors-home/ai-plugin-callout.tsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/routes/connectors-home/ai-plugin-callout.tsx b/routes/connectors-home/ai-plugin-callout.tsx index 70a9e372549b83..843d8de8f87d85 100644 --- a/routes/connectors-home/ai-plugin-callout.tsx +++ b/routes/connectors-home/ai-plugin-callout.tsx @@ -5,7 +5,12 @@ import { speak } from '@wordpress/a11y'; import { Button, ExternalLink } from '@wordpress/components'; import { store as coreStore } from '@wordpress/core-data'; import { useSelect, useDispatch } from '@wordpress/data'; -import { createInterpolateElement, useRef, useState } from '@wordpress/element'; +import { + createInterpolateElement, + useEffect, + useRef, + useState, +} from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { addQueryArgs } from '@wordpress/url'; @@ -35,6 +40,14 @@ for ( const c of connectorDataValues ) { export function AiPluginCallout() { const [ isBusy, setIsBusy ] = useState( false ); const [ justActivated, setJustActivated ] = useState( false ); + const actionButtonRef = useRef< HTMLButtonElement >( null ); + + // Restore focus to the button after install/activate completes. + useEffect( () => { + if ( justActivated ) { + actionButtonRef.current?.focus(); + } + }, [ justActivated ] ); // Server-side initial state — true if any provider was already connected at page load. const initialHasConnectedProvider = useRef( @@ -248,6 +261,7 @@ export function AiPluginCallout() { ) : ( - ) : ( - - ) } - + { showInstallActivate ? ( + + ) : ( + + ) } diff --git a/routes/connectors-home/style.scss b/routes/connectors-home/style.scss index bf050c105ee13a..a0a6d87533c6ba 100644 --- a/routes/connectors-home/style.scss +++ b/routes/connectors-home/style.scss @@ -60,6 +60,7 @@ $sticky-header-clearance: 120px; flex-direction: column; gap: 12px; padding-top: 2px; + align-items: flex-start; p { margin: 0; @@ -68,12 +69,6 @@ $sticky-header-clearance: 120px; } } - &__actions { - display: flex; - gap: 12px; - align-items: center; - } - &__decoration { position: absolute; inset-inline-end: 8px; From 754b955a0bc88d08db17718260f50adfc436975a Mon Sep 17 00:00:00 2001 From: Aki Hamano Date: Mon, 23 Mar 2026 19:36:36 +0900 Subject: [PATCH 5/7] Fix e2e test --- test/e2e/specs/admin/connectors.spec.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/e2e/specs/admin/connectors.spec.js b/test/e2e/specs/admin/connectors.spec.js index 802b999aa3d581..11c9829666efa1 100644 --- a/test/e2e/specs/admin/connectors.spec.js +++ b/test/e2e/specs/admin/connectors.spec.js @@ -386,7 +386,9 @@ test.describe( 'Connectors', () => { await expect( banner ).toBeVisible(); // Verify the banner message mentions the AI plugin. - await expect( banner.getByText( 'AI plugin' ) ).toBeVisible(); + await expect( + banner.locator( 'p' ).getByText( 'AI plugin' ) + ).toBeVisible(); // Verify the Install button is present. await expect( From 48be1119173a50cb61c9275c46fbece5f5cc88b3 Mon Sep 17 00:00:00 2001 From: Aki Hamano Date: Mon, 23 Mar 2026 19:42:00 +0900 Subject: [PATCH 6/7] Add ts-ignore --- routes/connectors-home/ai-plugin-callout.tsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/routes/connectors-home/ai-plugin-callout.tsx b/routes/connectors-home/ai-plugin-callout.tsx index f6cb7bef2cca71..a71acac49ba296 100644 --- a/routes/connectors-home/ai-plugin-callout.tsx +++ b/routes/connectors-home/ai-plugin-callout.tsx @@ -240,11 +240,8 @@ export function AiPluginCallout() {

{ createInterpolateElement( getMessage(), { strong: , - a: ( - - { __( 'Learn more' ) } - - ), + // @ts-ignore children are injected by createInterpolateElement at runtime. + a: , } ) }

{ showInstallActivate ? ( From f9882bbdd4c16c4608e3014c7dd70415e1ba9005 Mon Sep 17 00:00:00 2001 From: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Date: Mon, 23 Mar 2026 22:07:48 +0900 Subject: [PATCH 7/7] Update button text MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Greg Ziółkowski --- routes/connectors-home/ai-plugin-callout.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routes/connectors-home/ai-plugin-callout.tsx b/routes/connectors-home/ai-plugin-callout.tsx index a71acac49ba296..44390fc3813dff 100644 --- a/routes/connectors-home/ai-plugin-callout.tsx +++ b/routes/connectors-home/ai-plugin-callout.tsx @@ -264,7 +264,7 @@ export function AiPluginCallout() { page: AI_PLUGIN_SLUG, } ) } > - { __( 'Enable features in the AI plugin' ) } + { __( 'Control features in the AI plugin' ) } ) }