diff --git a/packages/block-editor/src/components/preview-options/index.js b/packages/block-editor/src/components/preview-options/index.js index 17c0bcc58ad25..8e2611f77a4a4 100644 --- a/packages/block-editor/src/components/preview-options/index.js +++ b/packages/block-editor/src/components/preview-options/index.js @@ -33,10 +33,10 @@ export default function PreviewOptions( { className: 'block-editor-post-preview__button-toggle', disabled: ! isEnabled, /* translators: button label text should, if possible, be under 16 characters. */ - children: __( 'Preview' ), + children: __( 'View' ), }; const menuProps = { - 'aria-label': __( 'Preview options' ), + 'aria-label': __( 'View options' ), }; return ( { const editorTopBar = this.page.locator( 'role=region[name="Editor top bar"i]' ); - const previewButton = editorTopBar.locator( - 'role=button[name="Preview"i]' - ); + const previewButton = editorTopBar.locator( 'role=button[name="View"i]' ); await previewButton.click(); const [ previewPage ] = await Promise.all( [ diff --git a/packages/edit-site/src/components/header/index.js b/packages/edit-site/src/components/header/index.js index 24e1ccd290995..0a880898f471f 100644 --- a/packages/edit-site/src/components/header/index.js +++ b/packages/edit-site/src/components/header/index.js @@ -11,8 +11,14 @@ import { import { useSelect, useDispatch } from '@wordpress/data'; import { PinnedItems } from '@wordpress/interface'; import { _x, __ } from '@wordpress/i18n'; -import { listView, plus } from '@wordpress/icons'; -import { Button, ToolbarItem } from '@wordpress/components'; +import { listView, plus, external } from '@wordpress/icons'; +import { + Button, + ToolbarItem, + MenuGroup, + MenuItem, + VisuallyHidden, +} from '@wordpress/components'; import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts'; import { store as editorStore } from '@wordpress/editor'; import { store as coreStore } from '@wordpress/core-data'; @@ -48,6 +54,7 @@ export default function Header( { listViewShortcut, isLoaded, isVisualMode, + settings, } = useSelect( ( select ) => { const { __experimentalGetPreviewDeviceType, @@ -56,6 +63,7 @@ export default function Header( { isInserterOpened, isListViewOpened, getEditorMode, + getSettings, } = select( editSiteStore ); const { getEditedEntityRecord } = select( coreStore ); const { __experimentalGetTemplateInfo: getTemplateInfo } = @@ -79,6 +87,7 @@ export default function Header( { 'core/edit-site/toggle-list-view' ), isVisualMode: getEditorMode() === 'visual', + settings: getSettings(), }; }, [] ); @@ -200,7 +209,23 @@ export default function Header( { + > + + + { __( 'View site' ) } + + { + /* translators: accessibility text */ + __( '(opens in a new tab)' ) + } + + + + ) } { await expect( title ).toBeEditable(); await expect( title ).toHaveText( '' ); - // Should display the Preview button. + // Should display the View button. await expect( - page.locator( 'role=button[name="Preview"i]' ) + page.locator( 'role=button[name="View"i]' ) ).toBeVisible(); // Should display the Post Formats UI. diff --git a/test/e2e/specs/editor/various/preview.spec.js b/test/e2e/specs/editor/various/preview.spec.js index 9cea861fa8e34..39456555f9686 100644 --- a/test/e2e/specs/editor/various/preview.spec.js +++ b/test/e2e/specs/editor/various/preview.spec.js @@ -24,7 +24,7 @@ test.describe( 'Preview', () => { // Disabled until content present. await expect( - editorPage.locator( 'role=button[name="Preview"i]' ) + editorPage.locator( 'role=button[name="View"i]' ) ).toBeDisabled(); await editorPage.type( @@ -275,8 +275,8 @@ test.describe( 'Preview with private custom post type', () => { } ) => { await admin.createNewPost( { postType: 'not_public', title: 'aaaaa' } ); - // Open the preview menu. - await page.click( 'role=button[name="Preview"i]' ); + // Open the view menu. + await page.click( 'role=button[name="View"i]' ); await expect( page.locator( 'role=menuitem[name="Preview in new tab"i]' ) @@ -291,7 +291,7 @@ class PreviewUtils { async waitForPreviewNavigation( previewPage ) { const previewToggle = this.page.locator( - 'role=button[name="Preview"i][expanded=false]' + 'role=button[name="View"i][expanded=false]' ); const isDropdownClosed = await previewToggle.isVisible(); if ( isDropdownClosed ) {