diff options
Diffstat (limited to 'animism-align/frontend/views/align/components/annotations/annotation.form.js')
| -rw-r--r-- | animism-align/frontend/views/align/components/annotations/annotation.form.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/animism-align/frontend/views/align/components/annotations/annotation.form.js b/animism-align/frontend/views/align/components/annotations/annotation.form.js index b62c36e..6972f93 100644 --- a/animism-align/frontend/views/align/components/annotations/annotation.form.js +++ b/animism-align/frontend/views/align/components/annotations/annotation.form.js @@ -22,6 +22,12 @@ class AnnotationForm extends Component { this.handleSelect = this.handleSelect.bind(this) this.handleKeyDown = this.handleKeyDown.bind(this) this.handleSubmit = this.handleSubmit.bind(this) + this.textareaRef = React.createRef() + } + componentDidMount() { + if (this.textareaRef && this.textareaRef.current) { + this.textareaRef.current.focus() + } } handleKeyDown(e) { if (e.keyCode === 27) { // escape @@ -111,6 +117,7 @@ class AnnotationForm extends Component { value={annotation.text} onKeyDown={this.handleKeyDown} onChange={this.handleChange} + ref={this.textareaRef} /> </div> ) |
