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

Unified Diff: third_party/WebKit/Source/devtools/front_end/ui/SwatchPopoverHelper.js

Issue 2377193004: [DevTools] Rework some focus code. (Closed)
Patch Set: 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/ui/SwatchPopoverHelper.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/SwatchPopoverHelper.js b/third_party/WebKit/Source/devtools/front_end/ui/SwatchPopoverHelper.js
index ae761d33eb43aafdce5afd60f4bff4e324ece546..bf08ab9da5278ddaf5aa62bfe352a38f167e29a8 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/SwatchPopoverHelper.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/SwatchPopoverHelper.js
@@ -67,13 +67,12 @@ WebInspector.SwatchPopoverHelper.prototype = {
reposition: function()
{
- if (!this._previousFocusElement)
- this._previousFocusElement = WebInspector.currentFocusElement();
// Unbind "blur" listener to avoid reenterability: |popover.showView| will hide the popover and trigger it synchronously.
this._view.contentElement.removeEventListener("focusout", this._boundFocusOut, false);
this._popover.showView(this._view, this._anchorElement);
this._view.contentElement.addEventListener("focusout", this._boundFocusOut, false);
- WebInspector.setCurrentFocusElement(this._view.contentElement);
+ if (!this._savedFocus)
+ this._savedFocus = WebInspector.saveFocusedElement(this._view.contentElement);
},
/**
@@ -93,8 +92,7 @@ WebInspector.SwatchPopoverHelper.prototype = {
if (this._hiddenCallback)
this._hiddenCallback.call(null, !!commitEdit);
- WebInspector.setCurrentFocusElement(this._previousFocusElement);
- delete this._previousFocusElement;
+ this._savedFocus = WebInspector.restoreFocusedElement(this._view.contentElement, this._savedFocus);
delete this._anchorElement;
if (this._view) {
this._view.detach();

Powered by Google App Engine
This is Rietveld 408576698