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

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: Passes closure compiliation. 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 /** Transfers focus to the input element. */ 51 /** Transfers focus to the input element. */
52 focus: function() { 52 focus: function() {
53 this.$$('#pin-input').focus(); 53 this.$$('#pin-input').focus();
54 }, 54 },
55 55
56 /** Called when a keypad number has been tapped. */ 56 /** Called when a keypad number has been tapped. */
57 onNumberTap_: function(event, detail) { 57 onNumberTap_: function(event, detail) {
58 var numberValue = event.target.getAttribute('value'); 58 var numberValue = event.target.getAttribute('value');
59 this.value += numberValue; 59 this.value += numberValue;
60
61 // If a number button is clicked, we do not want to switch focus to the
62 // button, therefore we transfer focus back to the input, but if a number
63 // button is tabbed into, it should keep focus, so users can use tab and
64 // spacebar/return to enter their PIN.
65 if (!event.target.classList.contains('keyboard-focus'))
jdufault 2016/07/12 19:59:44 What about just casting event.target to the right
66 this.focus();
60 }, 67 },
61 68
62 /** Fires a submit event with the current PIN value. */ 69 /** Fires a submit event with the current PIN value. */
63 firePinSubmitEvent_: function() { 70 firePinSubmitEvent_: function() {
64 this.fire('submit', { pin: this.value }); 71 this.fire('submit', { pin: this.value });
65 }, 72 },
66 73
67 /** 74 /**
68 * Fires an update event with the current PIN value. The event will only be 75 * Fires an update event with the current PIN value. The event will only be
69 * fired if the PIN value has actually changed. 76 * fired if the PIN value has actually changed.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // does not contain decimals. 142 // does not contain decimals.
136 // This heuristic will fail for inputs like '1.0'. 143 // This heuristic will fail for inputs like '1.0'.
137 // 144 //
138 // Since we still support users entering their passwords through the PIN 145 // Since we still support users entering their passwords through the PIN
139 // keyboard, we swap the input box to rtl when we think it is a password 146 // keyboard, we swap the input box to rtl when we think it is a password
140 // (just numbers), if the document direction is rtl. 147 // (just numbers), if the document direction is rtl.
141 var enableRtl = (document.dir == 'rtl') && !Number.isInteger(+password); 148 var enableRtl = (document.dir == 'rtl') && !Number.isInteger(+password);
142 return enableRtl ? 'input-non-pin' : ''; 149 return enableRtl ? 'input-non-pin' : '';
143 } 150 }
144 }); 151 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698