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

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

Issue 14329024: [DevTools] Close drawer on blur after short timeout. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Close drawer only in overlay mode. Created 7 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
Index: Source/devtools/front_end/Drawer.js
diff --git a/Source/devtools/front_end/Drawer.js b/Source/devtools/front_end/Drawer.js
index 3a67de1e6f1c6f30ccc0a02f07c01f6cb48ecf7b..6bcd4a1d290bb08ba1865f5b740fb7ed72af79e8 100644
--- a/Source/devtools/front_end/Drawer.js
+++ b/Source/devtools/front_end/Drawer.js
@@ -55,8 +55,18 @@ WebInspector.Drawer = function()
this._elementToAdjust = drawerIsOverlay ? this._floatingStatusBarContainer : this._mainElement;
document.body.enableStyleClass("drawer-overlay", drawerIsOverlay);
+
+ if (drawerIsOverlay) {
+ this._floatingStatusBarContainer.addEventListener("focusin", this._onFocus.bind(this));
+ this._floatingStatusBarContainer.addEventListener("focusout", this._onBlur.bind(this));
+
+ this.element.addEventListener("focusin", this._onFocus.bind(this));
+ this.element.addEventListener("focusout", this._onBlur.bind(this));
+ }
}
+WebInspector.Drawer._overlayCloseTimeout = 500;
pfeldman 2013/04/27 08:05:45 Why is there a timeout?
Dmitry Zvorygin 2013/04/29 16:02:35 Removed. Actually works fine even without timeout,
+
WebInspector.Drawer.AnimationType = {
Immediately: 0,
Normal: 1,
@@ -184,6 +194,21 @@ WebInspector.Drawer.prototype = {
setTimeout(adjustStyles.bind(this), 0);
},
+ _onFocus: function(event)
+ {
+ if (this._closeTimeout) {
+ clearTimeout(this._closeTimeout);
+ delete this._closeTimeout;
+ }
+ },
+
+ _onBlur: function(event)
+ {
+ if (this._closeTimeout)
+ clearTimeout(this._closeTimeout);
+ this._closeTimeout = setTimeout( WebInspector.closeDrawer.bind(WebInspector, WebInspector.Drawer.AnimationType.Normal), WebInspector.Drawer._overlayCloseTimeout);
+ },
+
resize: function()
{
if (!this.visible)
@@ -250,7 +275,7 @@ WebInspector.Drawer.prototype = {
this._savedHeight = this.element.offsetHeight;
delete this._statusBarDragOffset;
- event.consume();
+ event.consume(true);
}
}

Powered by Google App Engine
This is Rietveld 408576698