Chromium Code Reviews| 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 dda2f68041abcedc3f5136dfc8828851b4b2f6b5..17bb8221abc8a2d46c0a6c4f723807deb8363e06 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/ui/Dialog.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/ui/Dialog.js |
| @@ -73,7 +73,10 @@ WebInspector.Dialog.prototype = { |
| this._glassPane = new WebInspector.GlassPane(document, this._dimmed); |
| this._glassPane.element.addEventListener("click", this._onGlassPaneClick.bind(this), false); |
| - WebInspector.GlassPane.DefaultFocusedViewStack.push(this); |
| + |
| + // When a dialog closes, focus should be restored to the previous focused element when |
| + // possible, otherwise the default inspector view element. |
| + WebInspector.Dialog._previousFocusedElement = WebInspector.currentFocusElement() || WebInspector.inspectorView.defaultFocusedElement(); |
|
dgozman
2016/05/27 01:05:59
Use WebInspector.Dialog._modalHostView instead of
luoe
2016/05/27 23:20:40
Done.
|
| WebInspector.Widget.prototype.show.call(this, this._glassPane.element); |
| @@ -88,10 +91,11 @@ WebInspector.Dialog.prototype = { |
| { |
| WebInspector.Widget.prototype.detach.call(this); |
| - WebInspector.GlassPane.DefaultFocusedViewStack.pop(); |
| this._glassPane.dispose(); |
| delete this._glassPane; |
| + if (WebInspector.Dialog._previousFocusedElement) |
| + WebInspector.Dialog._previousFocusedElement.focus(); |
|
dgozman
2016/05/27 01:05:59
delete WebInspector.Dialog._previousFocusedElement
luoe
2016/05/27 23:20:40
Done.
|
| this._restoreTabIndexOnElements(); |
| delete WebInspector.Dialog._instance; |
| @@ -251,6 +255,9 @@ WebInspector.Dialog.prototype = { |
| __proto__: WebInspector.Widget.prototype |
| }; |
| +/** @type {?Element} */ |
| +WebInspector.Dialog._previousFocusedElement = null; |
| + |
| /** @type {?WebInspector.Widget} */ |
| WebInspector.Dialog._modalHostView = null; |