Skip to content

Commit

Permalink
Block Editor: Use full labels for directional block movers (#20664)
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth authored and jorgefilipecosta committed Mar 10, 2020
1 parent 42dedab commit f1ecdcc
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions packages/block-editor/src/components/block-mover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import classnames from 'classnames';
/**
* WordPress dependencies
*/
import { __, sprintf } from '@wordpress/i18n';
import { __ } from '@wordpress/i18n';
import { Button, ToolbarGroup } from '@wordpress/components';
import { getBlockType } from '@wordpress/blocks';
import { Component } from '@wordpress/element';
Expand Down Expand Up @@ -82,17 +82,17 @@ export class BlockMover extends Component {
return null;
};

const getMovementDirection = ( moveDirection ) => {
const getMovementDirectionLabel = ( moveDirection ) => {
if ( moveDirection === 'up' ) {
if ( orientation === 'horizontal' ) {
return isRTL ? 'right' : 'left';
return isRTL ? __( 'Move right' ) : __( 'Move left' );
}
return 'up';
return __( 'Move up' );
} else if ( moveDirection === 'down' ) {
if ( orientation === 'horizontal' ) {
return isRTL ? 'left' : 'right';
return isRTL ? __( 'Move left' ) : __( 'Move right' );
}
return 'down';
return __( 'Move down' );
}
return null;
};
Expand All @@ -112,11 +112,7 @@ export class BlockMover extends Component {
className="block-editor-block-mover__control"
onClick={ isFirst ? null : onMoveUp }
icon={ getArrowIcon( 'up' ) }
// translators: %s: Horizontal direction of block movement ( left, right )
label={ sprintf(
__( 'Move %s' ),
getMovementDirection( 'up' )
) }
label={ getMovementDirectionLabel( 'up' ) }
aria-describedby={ `block-editor-block-mover__up-description-${ instanceId }` }
aria-disabled={ isFirst }
onFocus={ this.onFocus }
Expand Down Expand Up @@ -145,11 +141,7 @@ export class BlockMover extends Component {
className="block-editor-block-mover__control"
onClick={ isLast ? null : onMoveDown }
icon={ getArrowIcon( 'down' ) }
// translators: %s: Horizontal direction of block movement ( left, right )
label={ sprintf(
__( 'Move %s' ),
getMovementDirection( 'down' )
) }
label={ getMovementDirectionLabel( 'down' ) }
aria-describedby={ `block-editor-block-mover__down-description-${ instanceId }` }
aria-disabled={ isLast }
onFocus={ this.onFocus }
Expand Down

0 comments on commit f1ecdcc

Please sign in to comment.