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

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

Issue 2119713003: Pin keyboard use enter to submit when focus is not on a button. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Fixed patch set 1 errors. Created 4 years, 6 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 dfc111d4c5fcd7c32df8aa1e7a95762d0894bfbb..b7e6e75f75ca7873a04ba378251fee03273d7c1a 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)
jdufault 2016/07/01 21:20:52 Can we traverse the DOM to find the focused elemen
sammiequon 2016/07/01 22:19:14 document.activeElement always returns the button i
+ this.focus();
},
/** Fires a submit event with the current PIN value. */
« 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