From 87c012b9f6e6794c8ee8ac380e49738ad2a2b6db Mon Sep 17 00:00:00 2001 From: Nimish Agrawal <37630020+nimishagarwal76@users.noreply.github.com> Date: Wed, 13 Mar 2019 01:47:27 +0530 Subject: [PATCH] Autofocus on Add File menu (#882) --- client/modules/IDE/components/NewFileForm.jsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client/modules/IDE/components/NewFileForm.jsx b/client/modules/IDE/components/NewFileForm.jsx index 8e3b5977..d0a6b8ab 100644 --- a/client/modules/IDE/components/NewFileForm.jsx +++ b/client/modules/IDE/components/NewFileForm.jsx @@ -8,6 +8,10 @@ class NewFileForm extends React.Component { this.createFile = this.props.createFile.bind(this); } + componentDidMount() { + this.fileName.focus(); + } + render() { const { fields: { name }, handleSubmit } = this.props; return ( @@ -25,6 +29,7 @@ class NewFileForm extends React.Component { type="text" placeholder="Name" {...domOnlyProps(name)} + ref={(element) => { this.fileName = element; }} /> {name.touched && name.error && {name.error}}