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

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

Issue 2706293007: [DevTools] Fix Dialog's close button to properly close dialog. (Closed)
Patch Set: test Created 3 years, 10 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/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 e47c1e9ce08d8ade450665e73ee79e31b197f7a3..cace1a296af311e3c4a53e4de98a49a7b21dcea4 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/Dialog.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/Dialog.js
@@ -33,11 +33,11 @@ UI.Dialog = class extends UI.GlassPane {
super();
this.registerRequiredCSS('ui/dialog.css');
this.contentElement.tabIndex = 0;
- this.contentElement.addEventListener('focus', this.focus.bind(this), false);
+ this.contentElement.addEventListener('focus', () => this.widget().focus(), false);
this.contentElement.addEventListener('keydown', this._onKeyDown.bind(this), false);
this.setBlockPointerEvents(true);
this.setSetOutsideClickCallback(event => {
- this.hideDialog();
+ this.hide();
event.consume(true);
});
/** @type {!Map<!HTMLElement, number>} */
@@ -54,22 +54,26 @@ UI.Dialog = class extends UI.GlassPane {
}
/**
+ * @override
* @param {!Document|!Element=} where
*/
- showDialog(where) {
+ show(where) {
var document = /** @type {!Document} */ (
where instanceof Document ? where : (where || UI.inspectorView.element).ownerDocument);
if (UI.Dialog._instance)
UI.Dialog._instance.detach();
UI.Dialog._instance = this;
this._disableTabIndexOnElements(document);
- this.showGlassPane(document);
- this._focusRestorer = new UI.WidgetFocusRestorer(this);
+ super.show(document);
+ this._focusRestorer = new UI.WidgetFocusRestorer(this.widget());
}
- hideDialog() {
+ /**
+ * @override
+ */
+ hide() {
this._focusRestorer.restore();
- this.hideGlassPane();
+ super.hide();
this._restoreTabIndexOnElements();
delete UI.Dialog._instance;
}
@@ -77,7 +81,7 @@ UI.Dialog = class extends UI.GlassPane {
addCloseButton() {
var closeButton = this.contentElement.createChild('div', 'dialog-close-button', 'dt-close-button');
closeButton.gray = true;
- closeButton.addEventListener('click', () => this.detach(), false);
+ closeButton.addEventListener('click', () => this.hide(), false);
}
/**
@@ -109,7 +113,7 @@ UI.Dialog = class extends UI.GlassPane {
_onKeyDown(event) {
if (event.keyCode === UI.KeyboardShortcut.Keys.Esc.code) {
event.consume(true);
- this.hideDialog();
+ this.hide();
}
}
};

Powered by Google App Engine
This is Rietveld 408576698