diff --git a/edit-post/store/effects.js b/edit-post/store/effects.js index 8e189e741def52..e864307b10f0cb 100644 --- a/edit-post/store/effects.js +++ b/edit-post/store/effects.js @@ -92,10 +92,13 @@ const effects = { INIT( _, store ) { // Select the block settings tab when the selected block changes subscribe( onChangeListener( - () => get( select( 'core/editor' ).getSelectedBlock(), 'uid' ), - ( selectedBlockUid ) => { - if ( selectedBlockUid && select( 'core/edit-post' ).isEditorSidebarOpened() ) { + () => select( 'core/editor' ).getBlockSelectionStart(), + ( selectionStart ) => { + const isSidebarOpened = select( 'core/edit-post' ).isEditorSidebarOpened(); + if ( selectionStart && isSidebarOpened ) { store.dispatch( openGeneralSidebar( 'edit-post/block' ) ); + } else if ( ! selectionStart && isSidebarOpened ) { + store.dispatch( openGeneralSidebar( 'edit-post/document' ) ); } } ) );