Skip to content

Commit

Permalink
Merge pull request #1875 from WordPress/update/fix-dropdown-menu-arro…
Browse files Browse the repository at this point in the history
…ws-nav

Fix DropdownMenu arrows navigation and add missing aria-label.
  • Loading branch information
afercia authored Jul 14, 2017
2 parents 0e8851e + 72958c8 commit 2440121
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 8 additions & 6 deletions blocks/library/table/table-block.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Editable from '../../editable';
import BlockControls from '../../block-controls';
import { Toolbar, DropdownMenu } from 'components';
import { __ } from 'i18n';

function execCommand( command ) {
return ( editor ) => {
Expand All @@ -13,32 +14,32 @@ function execCommand( command ) {
const TABLE_CONTROLS = [
{
icon: 'table-row-before',
title: wp.i18n.__( 'Insert Row Before' ),
title: __( 'Insert Row Before' ),
onClick: execCommand( 'mceTableInsertRowBefore' ),
},
{
icon: 'table-row-after',
title: wp.i18n.__( 'Insert Row After' ),
title: __( 'Insert Row After' ),
onClick: execCommand( 'mceTableInsertRowAfter' ),
},
{
icon: 'table-row-delete',
title: wp.i18n.__( 'Delete Row' ),
title: __( 'Delete Row' ),
onClick: execCommand( 'mceTableDeleteRow' ),
},
{
icon: 'table-col-before',
title: wp.i18n.__( 'Insert Column Before' ),
title: __( 'Insert Column Before' ),
onClick: execCommand( 'mceTableInsertColBefore' ),
},
{
icon: 'table-col-after',
title: wp.i18n.__( 'Insert Column After' ),
title: __( 'Insert Column After' ),
onClick: execCommand( 'mceTableInsertColAfter' ),
},
{
icon: 'table-col-delete',
title: wp.i18n.__( 'Delete Column' ),
title: __( 'Delete Column' ),
onClick: execCommand( 'mceTableDeleteCol' ),
},
];
Expand Down Expand Up @@ -89,6 +90,7 @@ export default class TableBlock extends wp.element.Component {
<li>
<DropdownMenu
icon="editor-table"
label={ __( 'Edit Table' ) }
controls={
TABLE_CONTROLS.map( ( control ) => ( {
...control,
Expand Down
2 changes: 2 additions & 0 deletions components/dropdown-menu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,14 @@ class DropdownMenu extends wp.element.Component {
case LEFT:
case UP:
keydown.preventDefault();
keydown.stopPropagation();
this.focusPrevious();
break;

case RIGHT:
case DOWN:
keydown.preventDefault();
keydown.stopPropagation();
this.focusNext();
break;

Expand Down

0 comments on commit 2440121

Please sign in to comment.