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

Unified Diff: third_party/WebKit/Source/devtools/front_end/components/Spectrum.js

Issue 2377193004: [DevTools] Rework some focus code. (Closed)
Patch Set: FocusRestorer Created 4 years, 3 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: third_party/WebKit/Source/devtools/front_end/components/Spectrum.js
diff --git a/third_party/WebKit/Source/devtools/front_end/components/Spectrum.js b/third_party/WebKit/Source/devtools/front_end/components/Spectrum.js
index 0d33461d0cab4c58eceabc08ddc92bc44206e657..f9fae6a195be0e9a7ff420d0b2e15f6a83a1d1f9 100644
--- a/third_party/WebKit/Source/devtools/front_end/components/Spectrum.js
+++ b/third_party/WebKit/Source/devtools/front_end/components/Spectrum.js
@@ -48,6 +48,7 @@ WebInspector.Spectrum = function()
WebInspector.VBox.call(this, true);
this.registerRequiredCSS("components/spectrum.css");
this.contentElement.tabIndex = 0;
+ this.setDefaultFocusedElement(this.contentElement);
this._colorElement = this.contentElement.createChild("div", "spectrum-color");
this._colorDragElement = this._colorElement.createChild("div", "spectrum-sat fill").createChild("div", "spectrum-val fill").createChild("div", "spectrum-dragger");
@@ -228,8 +229,8 @@ WebInspector.Spectrum.prototype = {
_focus: function()
{
- if (this.isShowing() && WebInspector.currentFocusElement() !== this.contentElement)
- WebInspector.setCurrentFocusElement(this.contentElement);
+ if (this.isShowing())
+ this.contentElement.focus();
},
/**
@@ -328,7 +329,7 @@ WebInspector.Spectrum.prototype = {
this._shadesContainer.appendChild(shadeElement);
}
- WebInspector.setCurrentFocusElement(this._shadesContainer);
+ this._shadesContainer.focus();
this._shadesCloseHandler = closeLightnessShades.bind(this, colorElement);
this._shadesContainer.ownerDocument.addEventListener("mousedown", this._shadesCloseHandler, true);
},

Powered by Google App Engine
This is Rietveld 408576698