Autofocus on Add File menu (#882)
This commit is contained in:
parent
3527568955
commit
87c012b9f6
1 changed files with 5 additions and 0 deletions
|
@ -8,6 +8,10 @@ class NewFileForm extends React.Component {
|
||||||
this.createFile = this.props.createFile.bind(this);
|
this.createFile = this.props.createFile.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.fileName.focus();
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { fields: { name }, handleSubmit } = this.props;
|
const { fields: { name }, handleSubmit } = this.props;
|
||||||
return (
|
return (
|
||||||
|
@ -25,6 +29,7 @@ class NewFileForm extends React.Component {
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Name"
|
placeholder="Name"
|
||||||
{...domOnlyProps(name)}
|
{...domOnlyProps(name)}
|
||||||
|
ref={(element) => { this.fileName = element; }}
|
||||||
/>
|
/>
|
||||||
<input type="submit" value="Add File" aria-label="add file" />
|
<input type="submit" value="Add File" aria-label="add file" />
|
||||||
{name.touched && name.error && <span className="form-error">{name.error}</span>}
|
{name.touched && name.error && <span className="form-error">{name.error}</span>}
|
||||||
|
|
Loading…
Reference in a new issue