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 90cf289bcb905ff3771653ffc354009b882d6b1f..f97522d1ece5cbd703935843ef727b50225405d8 100644 |
| --- a/chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js |
| +++ b/chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js |
| @@ -93,6 +93,16 @@ Polymer({ |
| }, |
| /** |
| + * Removes the space/enter key binds from the polymer iron-a11y-keys-behavior. |
|
jdufault
2016/09/22 20:04:01
I would move the function comment into the functio
sammiequon
2016/09/22 23:15:48
Done.
|
| + * @override |
| + */ |
| + attached: function() { |
| + var digitButtons = Polymer.dom(this.root).querySelectorAll('.digit-button'); |
| + for (var i = 0; i < digitButtons.length; ++i) |
| + digitButtons[i].keyEventTarget = null; |
| + }, |
| + |
| + /** |
| * Gets the container holding the password field. |
| * @type {!HTMLInputElement} |
| */ |
| @@ -209,7 +219,7 @@ Polymer({ |
| /** |
| * Keypress does not handle backspace but handles the char codes nicely, so we |
| * have a seperate event to process the backspaces. |
| - * @param {Event} event Keypress Event object. |
| + * @param {Event} event Keydown Event object. |
| * @private |
| */ |
| onKeyDown_: function(event) { |
| @@ -243,6 +253,21 @@ Polymer({ |
| return; |
| } |
| + // Space pressed. |
| + if (code == 32) { |
| + // Check if target was a number button. |
| + if (event.target.hasAttribute('value')) { |
| + var numberValue = event.target.getAttribute('value'); |
| + this.value += numberValue; |
| + return; |
| + } |
| + // Check if target was backspace button. |
| + if (event.target.classList.contains('backspace-button')) { |
| + this.onPinClear_(); |
| + return; |
| + } |
| + } |
| + |
| this.value += String.fromCharCode(code); |
| }, |