1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-24 04:48:03 +00:00

dialog input autofocus

This commit is contained in:
Michael An
2019-05-08 15:34:23 +08:00
parent 821aeeaae4
commit c1e86e937a
4 changed files with 36 additions and 2 deletions

View File

@@ -17,6 +17,12 @@ class AddRepoDialog extends React.Component {
repoName: '',
errMessage: '',
};
this.newInput = React.createRef();
}
componentDidMount() {
this.newInput.focus();
this.newInput.setSelectionRange(0, 0);
}
handleSubmit = () => {
@@ -69,6 +75,7 @@ class AddRepoDialog extends React.Component {
onKeyPress={this.handleKeyPress}
value={this.state.repoName}
onChange={this.handleChange}
innerRef={input => {this.newInput = input;}}
/>
</FormGroup>
</Form>