Skip to content

Commit

Permalink
Merge pull request #1618 from WordPress/try/editor-blocks-aria-label
Browse files Browse the repository at this point in the history
Add an aria-label to the editor blocks.
  • Loading branch information
afercia authored Jul 3, 2017
2 parents 2d7d544 + 61fa83c commit 9ef4572
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions editor/modes/visual-editor/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import CSSTransitionGroup from 'react-transition-group/CSSTransitionGroup';
import { Children, Component } from 'element';
import { BACKSPACE, ESCAPE, DELETE } from 'utils/keycodes';
import { getBlockType, getBlockDefaultClassname } from 'blocks';
import { __, sprintf } from 'i18n';

/**
* Internal dependencies
Expand Down Expand Up @@ -236,6 +237,8 @@ class VisualEditorBlock extends Component {
render() {
const { block, multiSelectedBlockUids } = this.props;
const blockType = getBlockType( block.name );
// translators: %s: Type of block (i.e. Text, Image etc)
const blockLabel = sprintf( __( 'Block: %s' ), blockType.title );
const { className = getBlockDefaultClassname( block.name ) } = blockType;
// The block as rendered in the editor is composed of general block UI
// (mover, toolbar, wrapper) and the display of the block content, which
Expand Down Expand Up @@ -283,6 +286,7 @@ class VisualEditorBlock extends Component {
className={ wrapperClassname }
data-type={ block.name }
tabIndex="0"
aria-label={ blockLabel }
{ ...wrapperProps }
>
{ ( showUI || isHovered ) && <BlockMover uids={ [ block.uid ] } /> }
Expand Down

0 comments on commit 9ef4572

Please sign in to comment.