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

Side by Side 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 2 errors. Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * 'pin-keyboard' is a keyboard that can be used to enter PINs or more generally 7 * 'pin-keyboard' is a keyboard that can be used to enter PINs or more generally
8 * numeric values. 8 * numeric values.
9 * 9 *
10 * Properties: 10 * Properties:
(...skipping 19 matching lines...) Expand all
30 value: { 30 value: {
31 type: String, 31 type: String,
32 notify: true, 32 notify: true,
33 value: '', 33 value: '',
34 observer: 'onPinValueChange_' 34 observer: 'onPinValueChange_'
35 } 35 }
36 }, 36 },
37 37
38 /** Transfers focus to the input element. */ 38 /** Transfers focus to the input element. */
39 focus: function() { 39 focus: function() {
40 this.$$('#pin-input').focus(); 40 var pinInput = this.$$('#pin-input');
41 pinInput.focus();
jdufault 2016/07/06 21:08:51 Revert these changes.
sammiequon 2016/07/06 23:38:02 Done.
41 }, 42 },
42 43
43 /** Called when a keypad number has been tapped. */ 44 /** Called when a keypad number has been tapped. */
44 onNumberTap_: function(event, detail) { 45 onNumberTap_: function(event, detail) {
45 var numberValue = event.target.getAttribute('value'); 46 var numberValue = event.target.getAttribute('value');
46 this.value += numberValue; 47 this.value += numberValue;
48
49 // If the number received focus from the mouse click, we trasnfer the focus
jdufault 2016/07/06 21:08:51 nit: transfer Can you update the comment to expla
sammiequon 2016/07/06 23:38:02 Done.
50 // to the input.
51 if (!event.target.receivedFocusFromKeyboard)
52 this.focus();
47 }, 53 },
48 54
49 /** Fires a submit event with the current PIN value. */ 55 /** Fires a submit event with the current PIN value. */
50 firePinSubmitEvent_: function() { 56 firePinSubmitEvent_: function() {
51 this.fire('submit', { pin: this.value }); 57 this.fire('submit', { pin: this.value });
52 }, 58 },
53 59
54 /** 60 /**
55 * Fires an update event with the current PIN value. The event will only be 61 * Fires an update event with the current PIN value. The event will only be
56 * fired if the PIN value has actually changed. 62 * fired if the PIN value has actually changed.
(...skipping 30 matching lines...) Expand all
87 }, 93 },
88 94
89 /** 95 /**
90 * Changes the color of the submit button if PIN is ready. 96 * Changes the color of the submit button if PIN is ready.
91 * @param {string} value 97 * @param {string} value
92 */ 98 */
93 computeSubmitClass_: function(value) { 99 computeSubmitClass_: function(value) {
94 return value.length > 0 ? 'ready-background' : ''; 100 return value.length > 0 ? 'ready-background' : '';
95 } 101 }
96 }); 102 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698