From aa8cf504f876182048e1f0e5b72b234b10a7f472 Mon Sep 17 00:00:00 2001 From: Simon Fondrie-Teitler Date: Wed, 26 Apr 2017 20:28:27 -0400 Subject: [feat] Go to first open line when enter is pressed When filling out the signup or login pages, and when adding an additional service provider, the enter key will trigger the submit action. When on the choose provider page, enter will take you to the next page. - Resolves: #8841 --- ui/app/components/password_field.js | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'ui/app/components/password_field.js') diff --git a/ui/app/components/password_field.js b/ui/app/components/password_field.js index 8397967f..654b8a57 100644 --- a/ui/app/components/password_field.js +++ b/ui/app/components/password_field.js @@ -8,13 +8,16 @@ import Validate from 'lib/validate' export default class PasswordField extends React.Component { - static get defaultProps() {return{ - id: null, // required. controlId of the element - label: "Password", - onChange: null, // callback passed current password - validationMode: "crack", // one of 'none', 'match', 'crack' - matchText: null, // used if validationMode == 'match' - }} + static get defaultProps() { + return { + id: null, // required. controlId of the element + label: "Password", + onChange: null, // callback passed current password + validationMode: "crack", // one of 'none', 'match', 'crack' + matchText: null, // used if validationMode == 'match' + inputRef: null, // a ref to the input. Used to set focus + } + } constructor(props) { super(props) @@ -43,14 +46,15 @@ export default class PasswordField extends React.Component { {this.props.label} + type="password" + inputRef={this.props.inputRef} + value={this.state.password || ""} + onChange={this.keypress} + /> {this.state.passwordState == 'success' ? null : } {passwordHelp} - ) + ) } keypress(e) { -- cgit v1.2.3