From 01df9e72e531be0c0ba65e3f49995d978439dc61 Mon Sep 17 00:00:00 2001 From: iseulde Date: Tue, 1 May 2018 15:31:06 +0200 Subject: [PATCH] Remove block movers if there is only one item --- editor/components/block-mover/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/editor/components/block-mover/index.js b/editor/components/block-mover/index.js index 7f19622f4f71b0..cfb4eb3280f3b7 100644 --- a/editor/components/block-mover/index.js +++ b/editor/components/block-mover/index.js @@ -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,