Index: third_party/WebKit/Source/devtools/front_end/ui/Dialog.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/Dialog.js b/third_party/WebKit/Source/devtools/front_end/ui/Dialog.js |
index a15b39a0ccea3dff0f1e678ed7805db4dbfe87d2..74ac91b55619e675524460ebe09c3c72de00e529 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/ui/Dialog.js |
+++ b/third_party/WebKit/Source/devtools/front_end/ui/Dialog.js |
@@ -41,7 +41,7 @@ WebInspector.Dialog = function() |
this.contentElement.createChild("content"); |
this.contentElement.tabIndex = 0; |
this.contentElement.addEventListener("focus", this._onFocus.bind(this), false); |
- this.contentElement.addEventListener("keydown", this._onKeyDown.bind(this), false); |
+ this._keyDownBound = this._onKeyDown.bind(this); |
this._wrapsContent = false; |
this._dimmed = false; |
@@ -50,7 +50,6 @@ WebInspector.Dialog = function() |
} |
/** |
- * TODO(dgozman): remove this method (it's only used for shortcuts handling). |
* @return {boolean} |
*/ |
WebInspector.Dialog.hasInstance = function() |
@@ -73,6 +72,7 @@ WebInspector.Dialog.prototype = { |
this._glassPane = new WebInspector.GlassPane(document, this._dimmed); |
this._glassPane.element.addEventListener("click", this._onGlassPaneClick.bind(this), false); |
+ this.element.ownerDocument.body.addEventListener("keydown", this._keyDownBound, false); |
// When a dialog closes, focus should be restored to the previous focused element when |
// possible, otherwise the default inspector view element. |
@@ -89,6 +89,7 @@ WebInspector.Dialog.prototype = { |
*/ |
detach: function() |
{ |
+ this.element.ownerDocument.body.removeEventListener("keydown", this._keyDownBound, false); |
WebInspector.Widget.prototype.detach.call(this); |
this._glassPane.dispose(); |