commit | 3b8d1780b324bbc3c19812acba44e354530af4d7 | [log] [tgz] |
---|---|---|
author | Jack Lynch <[email protected]> | Mon Apr 13 17:49:31 2020 |
committer | Commit Bot <[email protected]> | Tue Apr 14 00:13:23 2020 |
tree | 6a3b04b565484e4693459e1a8ff95952a4c4d6ac | |
parent | b0f7984519b7b785bd623f6374937fe307cc3baf [diff] [blame] |
Fix mac-only enter key regression This CL [1] changed the way certain actions are handled, including sources.rename, which is bound to the enter key on mac. An unintended consequence of this is that ShortcutRegistry now calls event.consume() on all enter keydown events, preventing them from activating buttons. The solution is to mark those actions as disabled when they are registered and exclude them from ShortcutRegistry's search for applicable actions. [1] https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2121565 Bug: 1070143 Change-Id: I6e73a00412f9df6163c0f587b66e2488ba8ac4f0 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2147716 Reviewed-by: Brandon Goddard <[email protected]> Reviewed-by: Kalon Hinds <[email protected]> Reviewed-by: Leo Lee <[email protected]> Commit-Queue: Jack Lynch <[email protected]>
diff --git a/front_end/ui/ActionRegistry.js b/front_end/ui/ActionRegistry.js index 291ca49..3d013f2 100644 --- a/front_end/ui/ActionRegistry.js +++ b/front_end/ui/ActionRegistry.js
@@ -33,6 +33,9 @@ } else { console.error(`Category actions require a title for command menu: ${actionId}`); } + if (!extension.canInstantiate()) { + action.setEnabled(false); + } } } @@ -59,7 +62,7 @@ const extensions = []; actionIds.forEach(function(actionId) { const action = this._actionsById.get(actionId); - if (action) { + if (action && action.enabled()) { extensions.push(action.extension()); } }, this);