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

WebUI: FindShortcutBehavior, default to listen on attach

Bug: 862839
Change-Id: Ie85e1abe1958665fef83f25c1eb3d437a2555f7b
Reviewed-on: https://chromium-review.googlesource.com/c/1396168Reviewed-by: default avatarDan Beam <dbeam@chromium.org>
Commit-Queue: Esmael El-Moslimany <aee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#620116}
parent f42f6bcf
...@@ -48,12 +48,6 @@ Polymer({ ...@@ -48,12 +48,6 @@ Polymer({
/** @override */ /** @override */
attached: function() { attached: function() {
this.$.dialog.showModal(); this.$.dialog.showModal();
this.becomeActiveFindShortcutListener();
},
/** @override */
detached: function() {
this.removeSelfAsFindShortcutListener();
}, },
// Override FindShortcutBehavior methods. // Override FindShortcutBehavior methods.
......
...@@ -59,6 +59,9 @@ Polymer({ ...@@ -59,6 +59,9 @@ Polymer({
/** @private {boolean} */ /** @private {boolean} */
lastActiveValue_: false, lastActiveValue_: false,
// Override FindShortcutBehavior property.
findShortcutListenOnAttach: false,
/** @override */ /** @override */
attached: function() { attached: function() {
if (!!this.searchLabel) { if (!!this.searchLabel) {
......
...@@ -181,13 +181,10 @@ Polymer({ ...@@ -181,13 +181,10 @@ Polymer({
scrollToTop(e.detail.bottom - this.$.container.clientHeight) scrollToTop(e.detail.bottom - this.$.container.clientHeight)
.then(e.detail.callback); .then(e.detail.callback);
}); });
this.becomeActiveFindShortcutListener();
}, },
/** @override */ /** @override */
detached: function() { detached: function() {
this.removeSelfAsFindShortcutListener();
settings.resetRouteForTesting(); settings.resetRouteForTesting();
}, },
......
...@@ -62,6 +62,24 @@ const FindShortcutManager = (() => { ...@@ -62,6 +62,24 @@ const FindShortcutManager = (() => {
* @polymerBehavior * @polymerBehavior
*/ */
const FindShortcutBehavior = { const FindShortcutBehavior = {
/**
* @type {boolean}
* @protected
*/
findShortcutListenOnAttach: true,
attached() {
if (this.findShortcutListenOnAttach) {
this.becomeActiveFindShortcutListener();
}
},
detached() {
if (this.findShortcutListenOnAttach) {
this.removeSelfAsFindShortcutListener();
}
},
/** /**
* If handled, return true. * If handled, return true.
* @param {boolean} modalContextOpen * @param {boolean} modalContextOpen
......
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