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 1 commit
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
1 change: 1 addition & 0 deletions blocks/library/table/table-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export default class TableBlock extends wp.element.Component {
<li>
<DropdownMenu
icon="editor-table"
label={ wp.i18n.__( 'Edit Table' ) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per #1332 (#1205), we should be explicit about dependencies on the i18n module, i.e. use import { __ } from 'i18n'; instead of assuming global.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep I know, I didn't want to change also all the other ones, because outside of the scope of this PR. But since we're here, I can do that if you agree.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't want to change also all the other ones, because outside of the scope of this PR.

Sure, especially in smaller pull requests like this one, I'm fine with some general refactoring sprinkled in as well. In an ideal world we'd have separate individual pull requests to refactor, but alas the world is not ideal and I find such PRs are few and far between.

But agree with the sentiment generally 👍

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