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

Fix DropdownMenu arrows navigation and add missing aria-label. #1875

Merged
merged 2 commits into from
Jul 14, 2017
Merged
Show file tree
Hide file tree
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
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