Commit 52ce86ed authored by Esmael El-Moslimany's avatar Esmael El-Moslimany Committed by Commit Bot

Settings: site-data, focus on site select button before navigating away

Bug: 872197
Change-Id: Ie98bf0737a9755312fda763053c9c15316b566be
Reviewed-on: https://chromium-review.googlesource.com/1168283Reviewed-by: default avatarHector Carmona <hcarmona@chromium.org>
Commit-Queue: Esmael El-Moslimany <aee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#582273}
parent 1c4f51eb
......@@ -158,19 +158,27 @@ Polymer({
lastSelectedIndex :
this.sites.length - 1;
const index = indexFromId > -1 ? indexFromId : indexFallback;
const ironList =
/** @type {!IronListElement} */ (this.$$('iron-list'));
ironList.focusItem(index);
const siteToSelect = this.sites[index].site.replace(/[.]/g, '\\.');
const button =
this.$$(`#siteItem_${siteToSelect}`).$$('.subpage-arrow button');
cr.ui.focusWithoutInk(assert(button));
this.focusOnSiteSelectButton_(index);
});
this.focusConfig.set(
settings.routes.SITE_SETTINGS_DATA_DETAILS.path, onNavigatedTo);
}
},
/**
* @param {number} index
* @private
*/
focusOnSiteSelectButton_: function(index) {
const ironList =
/** @type {!IronListElement} */ (this.$$('iron-list'));
ironList.focusItem(index);
const siteToSelect = this.sites[index].site.replace(/[.]/g, '\\.');
const button =
this.$$(`#siteItem_${siteToSelect}`).$$('.subpage-arrow button');
cr.ui.focusWithoutInk(assert(button));
},
/**
* Gather all the site data.
* @private
......@@ -239,6 +247,10 @@ Polymer({
* @private
*/
onSiteClick_: function(event) {
// If any delete button is selected, the focus will be in a bad state when
// returning to this page. To avoid this, the site select button is given
// focus. See https://crbug.com/872197.
this.focusOnSiteSelectButton_(event.model.index);
settings.navigateTo(
settings.routes.SITE_SETTINGS_DATA_DETAILS,
new URLSearchParams('site=' + event.model.item.site));
......
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