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..698139c711d8a0793d3b5102c574c41f209e8ea7 100644 |
| --- a/chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js |
| +++ b/chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js |
| @@ -93,6 +93,21 @@ Polymer({ |
| }, |
| /** |
| + * Removes the space/enter key binds from the polymer iron-a11y-keys-behavior. |
| + * @override |
| + */ |
| + attached: function() { |
| + var digitButtons = Polymer.dom(this.root).querySelectorAll('.digit-button'); |
| + for (var i = 0; i < digitButtons.length; ++i) { |
| + // There is a digit button with used for layout purposes that is not a |
| + // paper button or paper icon button. Do not call unlisten on this |
| + // element. |
| + if (!digitButtons[i].classList.contains('blank-space')) |
| + digitButtons[i]._unlistenKeyEventListeners(); |
|
jdufault
2016/09/20 22:54:00
Is this a polymer internal method? If so, we shoul
sammiequon
2016/09/21 01:37:00
Done. Replaced with keyEventTarget which is part o
|
| + } |
| + }, |
| + |
| + /** |
| * Gets the container holding the password field. |
| * @type {!HTMLInputElement} |
| */ |
| @@ -209,7 +224,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 +258,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); |
| }, |