Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1469)

Unified Diff: Source/devtools/front_end/Dialog.js

Issue 218613013: DevTools: Decouple shortcuts from actions, introduce shortcut contexts (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased patch Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/devtools/front_end/Context.js ('k') | Source/devtools/front_end/Drawer.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/Dialog.js
diff --git a/Source/devtools/front_end/Dialog.js b/Source/devtools/front_end/Dialog.js
index 7e9406dbf5a08d2452e8e81826cae1f405448e38..29a548c5c55046f43efaa8f38aca2741cbc81328 100644
--- a/Source/devtools/front_end/Dialog.js
+++ b/Source/devtools/front_end/Dialog.js
@@ -42,6 +42,7 @@ WebInspector.Dialog = function(relativeToElement, delegate)
// Install glass pane capturing events.
this._glassPane.element.tabIndex = 0;
this._glassPane.element.addEventListener("focus", this._onGlassPaneFocus.bind(this), false);
+ this._glassPane.element.addEventListener("keydown", this._onGlassPaneKeyDown.bind(this), false);
this._element = this._glassPane.element.createChild("div");
this._element.tabIndex = 0;
@@ -102,6 +103,20 @@ WebInspector.Dialog.prototype = {
this._hide();
},
+ /**
+ * @param {?Event} event
+ */
+ _onGlassPaneKeyDown: function(event)
+ {
+ var actions = WebInspector.KeyboardShortcut.applicableActions(/** @type {!KeyboardEvent} */ (event));
+ for (var i = 0; i < actions.length; ++i) {
+ if (actions[i].descriptor()["executeInDialog"])
+ return;
+ }
+ if (actions.length)
+ event.consume(true);
+ },
+
_onFocus: function(event)
{
this._delegate.focus();
« no previous file with comments | « Source/devtools/front_end/Context.js ('k') | Source/devtools/front_end/Drawer.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698