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

Unified Diff: chrome/browser/resources/settings/passwords_and_forms_page/passwords_and_forms_page.js

Issue 2804543005: MD Settings; Proposal on how to restore focus after subpage exiting.
Patch Set: Created 3 years, 8 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 | « chrome/browser/resources/settings/passwords_and_forms_page/passwords_and_forms_page.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/settings/passwords_and_forms_page/passwords_and_forms_page.js
diff --git a/chrome/browser/resources/settings/passwords_and_forms_page/passwords_and_forms_page.js b/chrome/browser/resources/settings/passwords_and_forms_page/passwords_and_forms_page.js
index 0598f0298e8f8515b7fc4ba993b5e115a4c9521c..1b0befe89ec72461f4459a85ffd7d1d71a23e1bf 100644
--- a/chrome/browser/resources/settings/passwords_and_forms_page/passwords_and_forms_page.js
+++ b/chrome/browser/resources/settings/passwords_and_forms_page/passwords_and_forms_page.js
@@ -5,13 +5,15 @@
Polymer({
is: 'settings-passwords-and-forms-page',
- behaviors: [PrefsBehavior],
+ behaviors: [PrefsBehavior, settings.RouteObserverBehavior],
properties: {
/** @private Filter applied to passwords and password exceptions. */
passwordFilter_: String,
},
+ lastOldRoute_: null,
+
/**
* Shows the manage autofill sub page.
* @param {!Event} event
@@ -29,4 +31,24 @@ Polymer({
onPasswordsTap_: function(event) {
settings.navigateTo(settings.Route.MANAGE_PASSWORDS);
},
+
+ currentRouteChanged: function(newRoute, oldRoute) {
+ this.lastOldRoute_ = oldRoute;
+
+ // neon-animatable has "display: none" until the animation finishes, so
+ // calling focus() on any of its children has no effect until
+ // "display: none" is removed. Using 'iron-select' listener which fires
+ // after the animation has finished allows focus() to work as expected.
+ },
+
+ onIronSelect_: function(e) {
+ if (e.detail.item != this.$$('neon-animatable'))
+ return;
+
+ var route = this.lastOldRoute_;
+ if (route == settings.Route.AUTOFILL)
+ this.$$('#autofillManagerButton .subpage-arrow').focus();
+ if (route == settings.Route.MANAGE_PASSWORDS)
+ this.$$('#passwordManagerButton .subpage-arrow').focus();
+ },
});
« no previous file with comments | « chrome/browser/resources/settings/passwords_and_forms_page/passwords_and_forms_page.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698