Skip to content

Commit

Permalink
Remove block movers if there is only one item
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed May 1, 2018
1 parent db4c94d commit 01df9e7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions editor/components/block-mover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,16 @@ export class BlockMover extends Component {
const { onMoveUp, onMoveDown, isFirst, isLast, uids, blockType, firstIndex, isLocked, instanceId, isHidden } = this.props;
const { isFocused } = this.state;
const blocksCount = castArray( uids ).length;

if ( isLocked ) {
return null;
}

// Don't render if there's only one block in the list.
if ( isFirst && isLast ) {
return null;
}

// We emulate a disabled state because forcefully applying the `disabled`
// attribute on the button while it has focus causes the screen to change
// to an unfocused state (body as active element) without firing blur on,
Expand Down

0 comments on commit 01df9e7

Please sign in to comment.