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

Unified Diff: ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js

Issue 2779903003: MD Settings: Potential <dialog> close focus workaround, WIP
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js
diff --git a/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js b/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js
index d15ed9b8173a769d12afe886806d1509a99cfffc..7660cf5e30f558c485ad9ece70385b4c088a4ee8 100644
--- a/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js
+++ b/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js
@@ -43,7 +43,7 @@ Polymer({
cancel: function() {
this.fire('cancel');
- HTMLDialogElement.prototype.close.call(this, '');
+ this.close('');
},
/**
@@ -51,7 +51,11 @@ Polymer({
* @override
*/
close: function(opt_returnValue) {
- HTMLDialogElement.prototype.close.call(this, 'success');
+ var returnValue = opt_returnValue == '' ? opt_returnValue : 'success';
+ // Moving the focus to a child of |this| that resides outside the
+ // |this.shadowRoot| seems to cause the focus to not be lost.
+ this.querySelector('paper-button').focus();
+ HTMLDialogElement.prototype.close.call(this, returnValue);
},
/** @return {!PaperIconButtonElement} */
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698