Skip to content

Commit

Permalink
Exit template focus when opening the W menu (#52235)
Browse files Browse the repository at this point in the history
  • Loading branch information
noisysocks authored Jul 5, 2023
1 parent 38904e9 commit 7ac218c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/edit-site/src/store/private-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { store as preferencesStore } from '@wordpress/preferences';
*/
export const setCanvasMode =
( mode ) =>
( { registry, dispatch } ) => {
( { registry, dispatch, select } ) => {
registry.dispatch( blockEditorStore ).__unstableSetEditorMode( 'edit' );
dispatch( {
type: 'SET_CANVAS_MODE',
Expand All @@ -26,6 +26,10 @@ export const setCanvasMode =
) {
dispatch.setIsListViewOpened( true );
}
// Switch focus away from editing the template when switching to view mode.
if ( mode === 'view' && select.isPage() ) {
dispatch.setHasPageContentFocus( true );
}
};

/**
Expand Down

0 comments on commit 7ac218c

Please sign in to comment.