Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(971)

Unified Diff: chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js

Issue 2357743002: chromeos: Backspace and enter key works as intended. (Closed)
Patch Set: Nit. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..d8b2762fb104855a57eb10cc72b4413c231f46ea 100644
--- a/chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js
+++ b/chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js
@@ -93,6 +93,17 @@ Polymer({
},
/**
+ * @override
+ */
+ attached: function() {
+ // Remove the space/enter key binds from the polymer
+ // iron-a11y-keys-behavior.
+ 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 +220,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 +254,21 @@ Polymer({
return;
}
+ // Space pressed. We want the old polymer function of space activating the
+ // button with focus.
+ if (code == 32) {
+ // Check if target was a number button.
+ if (event.target.hasAttribute('value')) {
+ this.value += event.target.getAttribute('value');
+ return;
+ }
+ // Check if target was backspace button.
+ if (event.target.classList.contains('backspace-button')) {
+ this.onPinClear_();
+ return;
+ }
+ }
+
this.value += String.fromCharCode(code);
},
« no previous file with comments | « chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698