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

Unified Diff: chrome/browser/resources/settings/on_startup_page/startup_urls_page.js

Issue 2782393004: MD Settings: Restore focus after closing dialogs, for startup page. (Closed)
Patch Set: Fix test. 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
Index: chrome/browser/resources/settings/on_startup_page/startup_urls_page.js
diff --git a/chrome/browser/resources/settings/on_startup_page/startup_urls_page.js b/chrome/browser/resources/settings/on_startup_page/startup_urls_page.js
index 6aa0f15420afe4ddcac98105f51df8cd239ef27e..e89623beef41cc6eeb572a35bb7cdd0649748c49 100644
--- a/chrome/browser/resources/settings/on_startup_page/startup_urls_page.js
+++ b/chrome/browser/resources/settings/on_startup_page/startup_urls_page.js
@@ -34,6 +34,12 @@ Polymer({
lastFocused_: Object,
},
+ /**
+ * The element to return focus to, when the startup-url-dialog is closed.
+ * @private {?HTMLElement}
+ */
+ startupUrlDialogAnchor_: null,
+
/** @override */
attached: function() {
this.browserProxy_ = settings.StartupUrlsPageBrowserProxyImpl.getInstance();
@@ -48,7 +54,8 @@ Polymer({
this.browserProxy_.loadStartupPages();
this.addEventListener(settings.EDIT_STARTUP_URL_EVENT, function(event) {
- this.startupUrlDialogModel_ = event.detail;
+ this.startupUrlDialogModel_ = event.detail.model;
+ this.startupUrlDialogAnchor_ = event.detail.anchor;
this.showStartupUrlDialog_ = true;
event.stopPropagation();
}.bind(this));
@@ -61,12 +68,18 @@ Polymer({
onAddPageTap_: function(e) {
e.preventDefault();
this.showStartupUrlDialog_ = true;
+ this.startupUrlDialogAnchor_ = /** @type {!HTMLElement} */ (
+ this.$$('#addPage a[is=action-link]'));
},
/** @private */
destroyUrlDialog_: function() {
this.showStartupUrlDialog_ = false;
this.startupUrlDialogModel_ = null;
+ if (this.startupUrlDialogAnchor_) {
+ this.startupUrlDialogAnchor_.focus();
+ this.startupUrlDialogAnchor_ = null;
+ }
},
/** @private */

Powered by Google App Engine
This is Rietveld 408576698