Commit 839ae6ef authored by Alex Vallée's avatar Alex Vallée Committed by Commit Bot

[chrome-signin] Reduce focus stealing.

With the OOPIF implementation of webview, the embedder page is not
considered focused when the guest has focus (it does not see any
keyboard input). This means that upon reaching the end of the
<webview>'s content and focusing an element in the embedder,
<paper-icon-button> in this case, the page is first refocused.

This event listener only seemed to expect this to happen once at the
beginning.

This CL prevents the authenticator from focusing the webview if another
element is focused when the page itself is focused.

The alternative would be to call focus only once, when constructing the
Authenticator.

Bug: 781748
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: Iac7020caad90c9e5e617f46bba392caeb09482b0
Reviewed-on: https://chromium-review.googlesource.com/775978
Commit-Queue: Alex Vallee <avallee@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#517511}
parent def91982
...@@ -432,8 +432,10 @@ cr.define('cr.login', function() { ...@@ -432,8 +432,10 @@ cr.define('cr.login', function() {
* @private * @private
*/ */
Authenticator.prototype.onFocus_ = function(e) { Authenticator.prototype.onFocus_ = function(e) {
if (this.authMode == AuthMode.DESKTOP) if (this.authMode == AuthMode.DESKTOP &&
document.activeElement == document.body) {
this.webview_.focus(); this.webview_.focus();
}
}; };
/** /**
......
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