Chromium Code Reviews| Index: chrome/browser/resources/md_bookmarks/command_manager.js |
| diff --git a/chrome/browser/resources/md_bookmarks/command_manager.js b/chrome/browser/resources/md_bookmarks/command_manager.js |
| index 7dbf8d0761bdc5483eb2c99414124e2efad14d2a..027cf2bf09910cbc29cb174c1c798c8805211b7c 100644 |
| --- a/chrome/browser/resources/md_bookmarks/command_manager.js |
| +++ b/chrome/browser/resources/md_bookmarks/command_manager.js |
| @@ -16,6 +16,13 @@ cr.define('bookmarks', function() { |
| ], |
| properties: { |
| + /** |
| + * If set, this will restrict keyboard shortcuts to only execute when a |
| + * child of this element (or <body>) is focused. |
|
calamity
2017/05/19 04:09:27
This is a bit confusing. Is 'this element' the com
tsergeant
2017/06/01 03:17:05
Obsolete
|
| + * @type {?Element} |
| + */ |
| + keyTarget: Object, |
| + |
| /** @private {!Array<Command>} */ |
| menuCommands_: { |
| type: Array, |
| @@ -324,8 +331,11 @@ cr.define('bookmarks', function() { |
| */ |
| onKeydown_: function(e) { |
| var selection = this.getState().selection.items; |
| - // TODO(tsergeant): Prevent keyboard shortcuts when a dialog is open or |
| - // text field is focused. |
| + if (this.keyTarget && e.path[0] != document.body && |
|
calamity
2017/05/19 04:09:27
Are there other exceptions that we need here? What
tsergeant
2017/06/01 03:17:05
Done, I think?
|
| + e.path.indexOf(this.keyTarget) == -1) { |
| + return; |
| + } |
| + |
| for (var commandName in this.shortcuts_) { |
| var shortcut = this.shortcuts_[commandName]; |
| if (Polymer.IronA11yKeysBehavior.keyboardEventMatchesKeys( |