Chromium Code Reviews| Index: chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js |
| diff --git a/chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js b/chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js |
| index ca343b2e90386434eff0b825f3037bc075960652..5d926c40bab7d1f345c0c8faae172d304cb7656e 100644 |
| --- a/chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js |
| +++ b/chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js |
| @@ -35,15 +35,32 @@ Polymer({ |
| } |
| }, |
| + // The current focused element. |
| + focusedElement_: undefined, |
| + |
| /** Transfers focus to the input element. */ |
| focus: function() { |
| - this.$$('#pin-input').focus(); |
| + var pinInput = this.$$('#pin-input'); |
| + pinInput.focus(); |
| + this.focusedElement_ = pinInput; |
| + }, |
| + |
| + /** Called when a pin keyboard has a key pressed. */ |
| + onButtonKeyUp_: function(event, detail) { |
| + // Only if tab has been pressed do we want change the focus. |
| + if (event.target.receivedFocusFromKeyboard) |
| + this.focusedElement_ = event.target; |
| }, |
| /** Called when a keypad number has been tapped. */ |
| onNumberTap_: function(event, detail) { |
| var numberValue = event.target.getAttribute('value'); |
| this.value += numberValue; |
| + |
| + // If the tabbed element is clicked we want to keep the focus, otherwise |
| + // transfer focus to the input. |
| + if (this.focusedElement_ != event.target) |
| + this.focus(); |
|
jdufault
2016/07/06 19:07:05
Can this just be
// Only focus buttons if the u
|
| }, |
| /** Fires a submit event with the current PIN value. */ |