Chromium Code Reviews| Index: ui/login/account_picker/user_pod_row.js |
| diff --git a/ui/login/account_picker/user_pod_row.js b/ui/login/account_picker/user_pod_row.js |
| index d4fd53a524e08184975591c09a676f8f5b18ab97..9d3370164209b292d8ece7a37e5c94b5a5fb780a 100644 |
| --- a/ui/login/account_picker/user_pod_row.js |
| +++ b/ui/login/account_picker/user_pod_row.js |
| @@ -2727,19 +2727,19 @@ cr.define('login', function() { |
| * @param {UserPod=} podToFocus User pod to focus (undefined clears focus). |
| * @param {boolean=} opt_force If true, forces focus update even when |
| * podToFocus is already focused. |
| + * @param {boolean=} opt_skip_input_focus If true, dont focus on the input |
|
dzhioev (left Google)
2015/07/17 18:48:50
nit: s/dont/don't/
bshe
2015/07/17 21:34:58
Done.
|
| + * box of user pod. |
| */ |
| - focusPod: function(podToFocus, opt_force) { |
| + focusPod: function(podToFocus, opt_force, opt_skip_input_focus) { |
|
dzhioev (left Google)
2015/07/17 18:48:50
nit: I'm not sure, but I think it should be called
bshe
2015/07/17 21:34:58
Done.
|
| if (this.isFocused(podToFocus) && !opt_force) { |
| // Calling focusPod w/o podToFocus means reset. |
| if (!podToFocus) |
| Oobe.clearErrors(); |
| - this.keyboardActivated_ = false; |
| return; |
| } |
| // Make sure there's only one focusPod operation happening at a time. |
| if (this.insideFocusPod_) { |
| - this.keyboardActivated_ = false; |
| return; |
| } |
| this.insideFocusPod_ = true; |
| @@ -2772,9 +2772,13 @@ cr.define('login', function() { |
| podToFocus.classList.add('focused'); |
| if (!podToFocus.multiProfilesPolicyApplied) { |
| podToFocus.classList.toggle('signing-in', false); |
| - podToFocus.focusInput(); |
| + if (!opt_skip_input_focus) |
| + podToFocus.focusInput(); |
| } else { |
| podToFocus.userTypeBubbleElement.classList.add('bubble-shown'); |
| + // Note it is not necessary to skip this focus request when |
| + // |opt_skip_input_focus| is true. When |multiProfilesPolicyApplied| |
| + // is false, it doesn't focus on the password input box by default. |
| podToFocus.focus(); |
| } |
| @@ -2788,7 +2792,6 @@ cr.define('login', function() { |
| this.scrollFocusedPodIntoView(); |
| } |
| this.insideFocusPod_ = false; |
| - this.keyboardActivated_ = false; |
| }, |
| /** |
| @@ -2995,9 +2998,19 @@ cr.define('login', function() { |
| var pod = findAncestorByClass(e.target, 'pod'); |
| if (pod && pod.parentNode == this) { |
| // Focus on a control of a pod but not on the action area button. |
| - if (!pod.classList.contains('focused') && |
| - !e.target.classList.contains('action-box-button')) { |
| - this.focusPod(pod); |
| + if (!pod.classList.contains('focused')) { |
| + if (e.target.classList.contains('action-box-area') || |
| + e.target.classList.contains('remove-warning-button')) { |
| + // focusPod usually moves focus on the password input box which |
| + // triggers virtual keyboard to show up. But the focus may move to a |
| + // non text input element shortly by e.target.focus. Hence, a |
| + // virtual keyboard flicking might be observed. We need to manually |
| + // prevent focus on password input box to avoid virtual keyboard |
| + // flicking in this case. See crbug.com/396016 for details. |
| + this.focusPod(pod, false, true /* opt_skip_input_focus */); |
| + } else { |
| + this.focusPod(pod); |
| + } |
| pod.userTypeBubbleElement.classList.remove('bubble-shown'); |
| e.target.focus(); |
| } |
| @@ -3029,7 +3042,6 @@ cr.define('login', function() { |
| switch (e.keyIdentifier) { |
| case 'Left': |
| if (!editing) { |
| - this.keyboardActivated_ = true; |
| if (this.focusedPod_ && this.focusedPod_.previousElementSibling) |
| this.focusPod(this.focusedPod_.previousElementSibling); |
| else |
| @@ -3040,7 +3052,6 @@ cr.define('login', function() { |
| break; |
| case 'Right': |
| if (!editing) { |
| - this.keyboardActivated_ = true; |
| if (this.focusedPod_ && this.focusedPod_.nextElementSibling) |
| this.focusPod(this.focusedPod_.nextElementSibling); |
| else |