diff --git a/packages/edit-post/src/components/layout/index.js b/packages/edit-post/src/components/layout/index.js
index d2452fe0fae6cd..5848da7b5b9b9d 100644
--- a/packages/edit-post/src/components/layout/index.js
+++ b/packages/edit-post/src/components/layout/index.js
@@ -181,6 +181,7 @@ function Layout( { styles } ) {
if ( mode === 'visual' && isListViewOpened ) {
return ;
}
+
return null;
};
diff --git a/packages/edit-post/src/components/preferences-modal/index.js b/packages/edit-post/src/components/preferences-modal/index.js
index 392099aae3300f..1ce688576b6576 100644
--- a/packages/edit-post/src/components/preferences-modal/index.js
+++ b/packages/edit-post/src/components/preferences-modal/index.js
@@ -115,6 +115,13 @@ export default function EditPostPreferencesModal() {
) }
label={ __( 'Spotlight mode' ) }
/>
+
+
+
+
),
},
diff --git a/packages/edit-site/src/index.js b/packages/edit-site/src/index.js
index 51045481291df4..2451f4cff3592e 100644
--- a/packages/edit-site/src/index.js
+++ b/packages/edit-site/src/index.js
@@ -64,8 +64,19 @@ export function reinitializeEditor( target, settings ) {
keepCaretInsideBlock: false,
welcomeGuide: true,
welcomeGuideStyles: true,
+ shouldListViewOpenByDefault: false,
} );
+ // Check if the block list view should be open by default.
+ if (
+ select( preferencesStore ).get(
+ 'core/edit-site',
+ 'showListViewByDefault'
+ )
+ ) {
+ dispatch( editSiteStore ).setIsListViewOpened( true );
+ }
+
dispatch( editSiteStore ).updateSettings( settings );
// Keep the defaultTemplateTypes in the core/editor settings too,
diff --git a/test/e2e/README.md b/test/e2e/README.md
index 0a6ecdc3121915..f1fb3d42c7898a 100644
--- a/test/e2e/README.md
+++ b/test/e2e/README.md
@@ -68,7 +68,7 @@ npm run test-e2e:playwright
npm run test-e2e:playwright -- --headed
# Run a single test file.
-npm run test-e2e:playwright --
+npm run test-e2e:playwright -- # E.g., npm run test-e2e:playwright -- site-editor/title.spec.js
# Debugging
npm run test-e2e:playwright -- --debug
diff --git a/test/e2e/specs/site-editor/block-list-panel-preference.spec.js b/test/e2e/specs/site-editor/block-list-panel-preference.spec.js
new file mode 100644
index 00000000000000..16a958eddbcc44
--- /dev/null
+++ b/test/e2e/specs/site-editor/block-list-panel-preference.spec.js
@@ -0,0 +1,40 @@
+/**
+ * WordPress dependencies
+ */
+const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );
+
+test.describe( 'Block list view', () => {
+ test.beforeAll( async ( { requestUtils } ) => {
+ await requestUtils.activateTheme( 'emptytheme' );
+ } );
+
+ test.afterAll( async ( { requestUtils } ) => {
+ await requestUtils.activateTheme( 'twentytwentyone' );
+ } );
+
+ test( 'Should open by default', async ( { page, pageUtils } ) => {
+ await pageUtils.visitSiteEditor( {
+ postId: 'emptytheme//index',
+ postType: 'wp_template',
+ } );
+
+ // Should display the Preview button.
+ await expect(
+ page.locator( 'role=region[name="List View"i]' )
+ ).not.toBeVisible();
+
+ // Turn on block list view by default.
+ await page.evaluate( () => {
+ window.wp.data
+ .dispatch( 'core/preferences' )
+ .set( 'core/edit-site', 'showListViewByDefault', true );
+ } );
+
+ await page.reload();
+
+ // Should display the Preview button.
+ await expect(
+ page.locator( 'role=region[name="List View"i]' )
+ ).toBeVisible();
+ } );
+} );