Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the verb Toggle from the Block Inserter button. #65983

Merged
merged 4 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/block-editor/src/components/inserter/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ function InserterMenu(
onSelect={ handleSetSelectedTab }
onClose={ onClose }
selectedTab={ selectedTab }
closeButtonLabel={ __( 'Close block inserter' ) }
closeButtonLabel={ __( 'Close Block Inserter' ) }
tabs={ [
{
name: 'blocks',
Expand Down
14 changes: 7 additions & 7 deletions packages/e2e-test-utils/src/inserter.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ async function isGlobalInserterOpen() {
return !! document.querySelector(
'.edit-post-header [aria-label="Add block"].is-pressed,' +
'.edit-site-header-edit-mode [aria-label="Add block"].is-pressed,' +
'.edit-post-header [aria-label="Toggle block inserter"].is-pressed,' +
'.edit-site-header [aria-label="Toggle block inserter"].is-pressed,' +
'.edit-widgets-header [aria-label="Toggle block inserter"].is-pressed,' +
'.edit-post-header [aria-label="Block Inserter"].is-pressed,' +
'.edit-site-header [aria-label="Block Inserter"].is-pressed,' +
'.edit-widgets-header [aria-label="Block Inserter"].is-pressed,' +
'.edit-widgets-header [aria-label="Add block"].is-pressed,' +
'.edit-site-header-edit-mode__inserter-toggle.is-pressed,' +
'.editor-header [aria-label="Toggle block inserter"].is-pressed'
'.editor-header [aria-label="Block Inserter"].is-pressed'
);
} );
}
Expand All @@ -68,10 +68,10 @@ export async function toggleGlobalBlockInserter() {
'.editor-document-tools__inserter-toggle,' +
'.edit-post-header [aria-label="Add block"],' +
'.edit-site-header [aria-label="Add block"],' +
'.edit-post-header [aria-label="Toggle block inserter"],' +
'.edit-site-header [aria-label="Toggle block inserter"],' +
'.edit-post-header [aria-label="Block Inserter"],' +
'.edit-site-header [aria-label="Block Inserter"],' +
'.edit-widgets-header [aria-label="Add block"],' +
'.edit-widgets-header [aria-label="Toggle block inserter"],' +
'.edit-widgets-header [aria-label="Block Inserter"],' +
'.edit-site-header-edit-mode__inserter-toggle'
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function DocumentTools() {
/* translators: button label text should, if possible, be under 16
characters. */
label={ _x(
'Toggle block inserter',
'Block Inserter',
'Generic label for block inserter button'
) }
size="compact"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default function InserterSidebar() {
__next40pxDefaultSize
icon={ close }
onClick={ closeInserter }
label={ __( 'Close block inserter' ) }
label={ __( 'Close Block Inserter' ) }
/>
</TagName>
<div className="edit-widgets-layout__inserter-panel-content">
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/components/document-tools/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function DocumentTools( { className, disableBlockTools = false } ) {

/* translators: button label text should, if possible, be under 16 characters. */
const longLabel = _x(
'Toggle block inserter',
'Block Inserter',
'Generic label for block inserter button'
);
const shortLabel = ! isInserterOpened ? __( 'Add' ) : __( 'Close' );
Expand Down
6 changes: 2 additions & 4 deletions test/e2e/specs/editor/blocks/columns.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ test.describe( 'Columns', () => {
.first()
.click();

// Toggle Block inserter
await page
.locator( 'role=button[name="Toggle block inserter"i]' )
.click();
// Block Inserter
await page.locator( 'role=button[name="Block Inserter"i]' ).click();

// Verify Column
const inserterOptions = page.locator(
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/specs/editor/blocks/group.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ test.describe( 'Group', () => {
} ) => {
// Search for the group block and insert it.
const inserterButton = page.locator(
'role=button[name="Toggle block inserter"i]'
'role=button[name="Block Inserter"i]'
);

await inserterButton.click();
Expand Down
3 changes: 2 additions & 1 deletion test/e2e/specs/editor/blocks/image.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,8 @@ test.describe( 'Image', () => {

async function openMediaTab() {
const blockInserter = page.getByRole( 'button', {
name: 'Toggle block inserter',
name: 'Block Inserter',
exact: true,
} );
const isClosed =
( await blockInserter.getAttribute( 'aria-pressed' ) ) ===
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/specs/editor/plugins/allowed-blocks.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test.describe( 'Allowed Blocks Filter', () => {
} ) => {
// The paragraph block is available.
await page
.getByRole( 'button', { name: 'Toggle block inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

const searchbox = page
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/specs/editor/plugins/block-directory.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ test.describe( 'Block Directory', () => {

await page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Toggle block inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

const blockLibrary = page.getByRole( 'region', {
Expand Down Expand Up @@ -209,7 +209,7 @@ test.describe( 'Block Directory', () => {

await page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Toggle block inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

const blockLibrary = page.getByRole( 'region', {
Expand Down
10 changes: 5 additions & 5 deletions test/e2e/specs/editor/plugins/block-icons.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ test.describe( 'Block Icons', () => {
test( 'Block with svg icon', async ( { editor, page } ) => {
await page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Toggle block inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

const blockLibrary = page.getByRole( 'region', {
Expand Down Expand Up @@ -60,7 +60,7 @@ test.describe( 'Block Icons', () => {
test( 'Block with dash icon', async ( { editor, page } ) => {
await page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Toggle block inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

const blockLibrary = page.getByRole( 'region', {
Expand Down Expand Up @@ -100,7 +100,7 @@ test.describe( 'Block Icons', () => {
test( 'Block with function icon', async ( { editor, page } ) => {
await page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Toggle block inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

const blockLibrary = page.getByRole( 'region', {
Expand Down Expand Up @@ -137,7 +137,7 @@ test.describe( 'Block Icons', () => {
} ) => {
await page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Toggle block inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

const blockLibrary = page.getByRole( 'region', {
Expand Down Expand Up @@ -185,7 +185,7 @@ test.describe( 'Block Icons', () => {
} ) => {
await page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Toggle block inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

const blockLibrary = page.getByRole( 'region', {
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/specs/editor/plugins/block-variations.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ test.describe( 'Block variations', () => {
page,
} ) => {
await page
.getByRole( 'button', { name: 'Toggle block inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

await page
Expand Down Expand Up @@ -63,7 +63,7 @@ test.describe( 'Block variations', () => {
page,
} ) => {
await page
.getByRole( 'button', { name: 'Toggle block inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

await page
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/specs/editor/plugins/child-blocks.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test.describe( 'Child Blocks', () => {
test( 'are hidden from the global block inserter', async ( { page } ) => {
const blockInserter = page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Toggle block inserter' } );
.getByRole( 'button', { name: 'Block Inserter', exact: true } );
const blockLibrary = page.getByRole( 'region', {
name: 'Block Library',
} );
Expand Down Expand Up @@ -47,7 +47,7 @@ test.describe( 'Child Blocks', () => {

const blockInserter = page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Toggle block inserter' } );
.getByRole( 'button', { name: 'Block Inserter', exact: true } );
const blockLibrary = page
.getByRole( 'region', {
name: 'Block Library',
Expand Down Expand Up @@ -85,7 +85,7 @@ test.describe( 'Child Blocks', () => {

const blockInserter = page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Toggle block inserter' } );
.getByRole( 'button', { name: 'Block Inserter', exact: true } );
const blockLibrary = page
.getByRole( 'region', {
name: 'Block Library',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ test.describe( 'Allowed Blocks Setting on InnerBlocks', () => {

const blockInserter = page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Toggle block inserter' } );
.getByRole( 'button', { name: 'Block Inserter', exact: true } );
const blockLibrary = page
.getByRole( 'region', {
name: 'Block Library',
Expand Down Expand Up @@ -92,7 +92,7 @@ test.describe( 'Allowed Blocks Setting on InnerBlocks', () => {

const blockInserter = page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Toggle block inserter' } );
.getByRole( 'button', { name: 'Block Inserter', exact: true } );
const blockLibrary = page
.getByRole( 'region', {
name: 'Block Library',
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/specs/editor/plugins/pattern-recursion.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ test.describe( 'Preventing Pattern Recursion (server)', () => {
page,
editor,
} ) => {
// Click the Toggle block inserter button
// Click the Block Inserter button
await page
.getByRole( 'button', { name: 'Toggle block inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();
// Click the Patterns tab
await page.getByRole( 'tab', { name: 'Patterns' } ).click();
Expand Down
5 changes: 4 additions & 1 deletion test/e2e/specs/editor/plugins/post-type-locking.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,10 @@ test.describe( 'Post-type locking', () => {
await expect(
page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Toggle block inserter' } )
.getByRole( 'button', {
name: 'Block Inserter',
exact: true,
} )
).toBeEnabled();

await editor.insertBlock( { name: 'core/list' } );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ test.describe( 'Register block type hooks', () => {
} );

test( 'has a custom category for Paragraph block', async ( { page } ) => {
await page.click( 'role=button[name="Toggle block inserter"i]' );
await page.click( 'role=button[name="Block Inserter"i]' );

expect(
page.locator(
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/specs/editor/various/a11y.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ test.describe( 'a11y (@firefox, @webkit)', () => {

// This test assumes the Editor is not in Fullscreen mode. Check the
// first tabbable element within the 'Editor top bar' region is the
// 'Toggle block inserter' button.
// 'Block Inserter' button.
await pageUtils.pressKeys( 'Tab' );
await expect(
page.locator( 'role=button[name=/Toggle block inserter/i]' )
page.locator( 'role=button[name=/Block Inserter/i]' )
).toBeFocused();
} );

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/specs/editor/various/adding-patterns.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ test.describe( 'adding patterns', () => {
} );

test( 'should insert a block pattern', async ( { page, editor } ) => {
await page.getByLabel( 'Toggle block inserter' ).click();
await page.getByLabel( 'Block Inserter' ).click();

await page.getByRole( 'tab', { name: 'Patterns' } ).click();
await page.fill(
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/specs/editor/various/allowed-patterns.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ test.describe( 'Allowed Patterns', () => {
await admin.createNewPost();
await page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Toggle block inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

await page
Expand Down Expand Up @@ -61,7 +61,7 @@ test.describe( 'Allowed Patterns', () => {
await admin.createNewPost();
await page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Toggle block inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

await page
Expand Down
12 changes: 6 additions & 6 deletions test/e2e/specs/editor/various/block-visibility.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ test.describe( 'Block Visibility', () => {
.getByRole( 'button', { name: 'Close' } )
.click();
await page
.getByRole( 'button', { name: 'Toggle block inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();
await page
.getByRole( 'region', { name: 'Block Library' } )
Expand All @@ -60,7 +60,7 @@ test.describe( 'Block Visibility', () => {
).toBeHidden();

await page
.getByRole( 'button', { name: 'Toggle block inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

// Show heading block again.
Expand All @@ -84,7 +84,7 @@ test.describe( 'Block Visibility', () => {
.getByRole( 'button', { name: 'Close' } )
.click();
await page
.getByRole( 'button', { name: 'Toggle block inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();
await page
.getByRole( 'region', { name: 'Block Library' } )
Expand Down Expand Up @@ -118,7 +118,7 @@ test.describe( 'Block Visibility', () => {
.getByRole( 'button', { name: 'Close' } )
.click();
await page
.getByRole( 'button', { name: 'Toggle block inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

await expect(
Expand All @@ -129,7 +129,7 @@ test.describe( 'Block Visibility', () => {
).toBeHidden();

await page
.getByRole( 'button', { name: 'Toggle block inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

// Show Media category blocks again.
Expand All @@ -153,7 +153,7 @@ test.describe( 'Block Visibility', () => {
.getByRole( 'button', { name: 'Close' } )
.click();
await page
.getByRole( 'button', { name: 'Toggle block inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

await expect(
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/specs/editor/various/editor-modes.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ test.describe( 'Editing modes (visual/HTML)', () => {
await expect(
page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Toggle block inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
).toBeDisabled();

// Go back to the visual editor.
Expand Down
Loading
Loading