Skip to content

Commit

Permalink
Added autofocus for input boxes
Browse files Browse the repository at this point in the history
  • Loading branch information
shobrook committed Mar 19, 2020
1 parent 99aa63f commit a2587ac
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/components/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ import "./Input.css";

export default class Input extends Component {
render() {
const { placeholder, value, onChange, inErrorMode } = this.props;
const {
placeholder,
value,
onChange,
inErrorMode,
autofocus
} = this.props;

return (
<input
Expand All @@ -12,7 +18,12 @@ export default class Input extends Component {
placeholder={placeholder}
value={value}
onChange={onChange}
autofocus={autofocus ? "true" : "false"}
/>
);
}
}

Input.defaultProps = {
autofocus: false
};
1 change: 1 addition & 0 deletions src/containers/CryptForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export default class CryptForm extends Component {
this.setState({ password: event.target.value })
}
inErrorMode={displayError}
autofocus
/>
{!isDecryption ? (
<Input
Expand Down

0 comments on commit a2587ac

Please sign in to comment.