Skip to content

Commit 71f2920

Browse files
committed
Focus instructions editor on first mount
But only if the instructions are currently empty; if they aren't, the cursor starts at the beginning of the text, which is annoying.
1 parent 310dba8 commit 71f2920

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/components/InstructionsEditor.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ export default class InstructionsEditor extends React.Component {
99
bindAll(this, '_handleCancelEditing', '_handleSaveChanges', '_ref');
1010
}
1111

12+
componentDidMount() {
13+
if (!this.props.instructions) {
14+
this._editor.focus();
15+
}
16+
}
17+
1218
_handleCancelEditing() {
1319
this.props.onCancelEditing();
1420
}

0 commit comments

Comments
 (0)