Commit ffdfceb6 authored by Daniel Classon's avatar Daniel Classon Committed by Commit Bot

[MultidevicePage] Add focus override to multidevice feature item

Adds an override to the focus() function for the multidevice feature
item so that the feature controller is focused when the item is focused.
Helps with adding deep links to the multidevice page.

Bug: 1084154
Change-Id: I9a5c382ccf5b5d6c6f6315bd4da200949e7b2c7b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2417142Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Commit-Queue: Daniel Classon <dclasson@google.com>
Cr-Commit-Position: refs/heads/master@{#808110}
parent a0208ad0
...@@ -47,6 +47,7 @@ js_library("multidevice_feature_item") { ...@@ -47,6 +47,7 @@ js_library("multidevice_feature_item") {
"..:route_origin_behavior", "..:route_origin_behavior",
"../..:router", "../..:router",
"../localized_link:localized_link", "../localized_link:localized_link",
"//ui/webui/resources/js:assert",
"//ui/webui/resources/js:cr", "//ui/webui/resources/js:cr",
] ]
} }
...@@ -183,6 +184,7 @@ js_library("multidevice_feature_item.m") { ...@@ -183,6 +184,7 @@ js_library("multidevice_feature_item.m") {
"../..:router.m", "../..:router.m",
"../localized_link:localized_link.m", "../localized_link:localized_link.m",
"//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
"//ui/webui/resources/js:assert.m",
] ]
extra_deps = [ ":multidevice_feature_item_module" ] extra_deps = [ ":multidevice_feature_item_module" ]
} }
...@@ -300,7 +302,8 @@ polymer_modulizer("multidevice_feature_item") { ...@@ -300,7 +302,8 @@ polymer_modulizer("multidevice_feature_item") {
html_type = "dom-module" html_type = "dom-module"
migrated_imports = os_settings_migrated_imports migrated_imports = os_settings_migrated_imports
namespace_rewrites = os_settings_namespace_rewrites namespace_rewrites = os_settings_namespace_rewrites
auto_imports = os_settings_auto_imports auto_imports = os_settings_auto_imports +
[ "ui/webui/resources/html/assert.html|assert" ]
} }
polymer_modulizer("multidevice_feature_toggle") { polymer_modulizer("multidevice_feature_toggle") {
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html"> <link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html"> <link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/assert.html">
<link rel="import" href="chrome://resources/html/cr.html"> <link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
<link rel="import" href="../os_route.html"> <link rel="import" href="../os_route.html">
......
...@@ -42,6 +42,16 @@ Polymer({ ...@@ -42,6 +42,16 @@ Polymer({
this.addFocusConfig_(this.subpageRoute, '#subpageButton'); this.addFocusConfig_(this.subpageRoute, '#subpageButton');
}, },
/** @override */
focus() {
const slot = this.$$('slot[name="feature-controller"]');
const elems = slot.assignedElements({flatten: true});
assert(elems.length > 0);
// Elems contains any elements that override the feature controller. If none
// exist, contains the default toggle elem.
elems[0].focus();
},
/** /**
* @return {boolean} * @return {boolean}
* @private * @private
......
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