Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inserter / block directory issues #17517

Merged
merged 4 commits into from
Sep 26, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Only show help panel when blocks are available
  • Loading branch information
talldan committed Sep 23, 2019
commit ef0ea34fcbfbf9ea6b9547a86e5fde691db0b72a
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 ) );
talldan marked this conversation as resolved.
Show resolved Hide resolved
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