Skip to content

Commit

Permalink
Only show help panel when blocks are available
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan committed Sep 23, 2019
1 parent fcb5f74 commit ef0ea34
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/block-editor/src/components/inserter/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,11 @@ export class InserterMenu extends Component {
suggestedItems,
filterValue,
} = this.state;

const isPanelOpen = ( panel ) => openPanels.indexOf( panel ) !== -1;
const hasItems = ! ( isEmpty( suggestedItems ) && isEmpty( reusableItems ) && isEmpty( itemsPerCategory ) );
const hoveredItemBlockType = hoveredItem ? getBlockType( hoveredItem.name ) : null;
const hasHelpPanel = hasItems && showInserterHelpPanel;

// Disable reason (no-autofocus): The inserter menu is a modal display, not one which
// is always visible, and one which already incurs this behavior of autoFocus via
Expand All @@ -277,7 +279,7 @@ export class InserterMenu extends Component {
return (
<div
className={ classnames( 'editor-inserter__menu block-editor-inserter__menu', {
'has-help-panel': showInserterHelpPanel,
'has-help-panel': hasHelpPanel,
} ) }
onKeyPress={ stopKeyPropagation }
onKeyDown={ this.onKeyDown }
Expand Down Expand Up @@ -382,7 +384,7 @@ export class InserterMenu extends Component {
</div>
</div>

{ hasItems && showInserterHelpPanel && (
{ hasHelpPanel && (
<div className="block-editor-inserter__menu-help-panel">
{ hoveredItem && (
<>
Expand Down

0 comments on commit ef0ea34

Please sign in to comment.