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

Block Editor: Use full labels for directional block movers #20664

Merged
merged 1 commit into from
Mar 6, 2020
Merged
Changes from all commits
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
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 @@ -118,11 +118,7 @@ export class BlockMover extends Component {
className="block-editor-block-mover__control block-editor-block-mover__control-up"
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 All @@ -133,11 +129,7 @@ export class BlockMover extends Component {
className="block-editor-block-mover__control block-editor-block-mover__control-down"
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