Commit 90d2f5c0 authored by Jan Wilken Dörrie's avatar Jan Wilken Dörrie Committed by Commit Bot

[Passwords] Add focusConfig for Password Check button

This change adds a focusConfig for the Password Check button to
passwords_section.js, allowing for the proper highlighting when
navigating from chrome://settings/passwords/check to
chrome://settings/passwords.

Since the Password Check button is not an immediate child of the parent
autofill page, but rather embedded within the passwords section, a
single query selector string is not sufficient, and executing our own
handler is required.

Fixed: 1101298
Change-Id: I76a23778461880e38f23a25f2b9f4d2ca5328dae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2275455
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: default avatardpapad <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#785952}
parent 7311255f
......@@ -33,7 +33,7 @@
search-label="$i18n{searchPasswords}"
search-term="{{passwordFilter_}}">
<passwords-section id="passwordSection" filter="[[passwordFilter_]]"
prefs="{{prefs}}">
focus-config="[[focusConfig_]]" prefs="{{prefs}}">
</passwords-section>
</settings-subpage>
</template>
......
......@@ -133,7 +133,7 @@
$i18n{checkPasswordsDescription}
</div>
</div>
<cr-icon-button class="subpage-arrow"
<cr-icon-button id="icon" class="subpage-arrow"
aria-label="$i18n{checkPasswords}">
</cr-icon-button>
</div>
......
......@@ -95,6 +95,12 @@ Polymer({
storedAccounts_: Array,
// </if>
/** @type {!Map<string, (string|Function)>} */
focusConfig: {
type: Object,
observer: 'focusConfigChanged_',
},
/** Preferences state. */
prefs: {
type: Object,
......@@ -308,6 +314,26 @@ Polymer({
*/
setPasswordExceptionsListener_: null,
/**
* @param {!Map<string, string>} newConfig
* @param {?Map<string, string>} oldConfig
* @private
*/
focusConfigChanged_(newConfig, oldConfig) {
// focusConfig is set only once on the parent, so this observer should
// only fire once.
assert(!oldConfig);
// Populate the |focusConfig| map of the parent <settings-autofill-page>
// element, with additional entries that correspond to subpage trigger
// elements residing in this element's Shadow DOM.
if (this.enablePasswordCheck_) {
this.focusConfig.set(assert(routes.CHECK_PASSWORDS).path, () => {
focusWithoutInk(assert(this.$$('#icon')));
});
}
},
/** @override */
attached() {
// Create listener functions.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment