Skip to content

Commit

Permalink
turn off focusMode on site editor load
Browse files Browse the repository at this point in the history
  • Loading branch information
Addison-Stavlo authored and jeyip committed Aug 11, 2020
1 parent 41059e4 commit 79e8ca4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/edit-site/src/components/editor/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* WordPress dependencies
*/
import { useState, useMemo, useCallback } from '@wordpress/element';
import { useState, useMemo, useCallback, useEffect } from '@wordpress/element';
import { useSelect, useDispatch } from '@wordpress/data';
import {
SlotFillProvider,
Expand Down Expand Up @@ -57,6 +57,7 @@ function Editor() {
page,
template,
select,
isFocusModeActive,
} = useSelect( ( _select ) => {
const {
isFeatureActive,
Expand All @@ -80,6 +81,7 @@ function Editor() {

return {
isFullscreenActive: isFeatureActive( 'fullscreenMode' ),
isFocusModeActive: isFeatureActive( 'focusMode' ),
deviceType: __experimentalGetPreviewDeviceType(),
sidebarIsOpened: !! _select(
'core/interface'
Expand All @@ -99,7 +101,14 @@ function Editor() {
};
}, [] );
const { editEntityRecord } = useDispatch( 'core' );
const { setPage } = useDispatch( 'core/edit-site' );
const { setPage, toggleFeature } = useDispatch( 'core/edit-site' );

// Disable focus mode on load (focusMode used for template part visibility in site editor).
useEffect( () => {
if ( isFocusModeActive ) {
toggleFeature( 'focusMode' );
}
}, [] );

const inlineStyles = useResizeCanvas( deviceType );

Expand Down

0 comments on commit 79e8ca4

Please sign in to comment.