Auto-focus on comment box and submit with enter key

Reviewed By: passy

Differential Revision: D17284726

fbshipit-source-id: 75c76b204668a9fcd770e68dbccad278dc81d8e4
This commit is contained in:
John Knox
2019-09-10 10:37:44 -07:00
committed by Facebook Github Bot
parent 263a738972
commit bd35768590

View File

@@ -199,6 +199,10 @@ class FeedbackComponent extends Component<
placeholder={this.props.promptData.commentPlaceholder} placeholder={this.props.promptData.commentPlaceholder}
value={this.state.comment} value={this.state.comment}
onChange={e => this.setState({comment: e.target.value})} onChange={e => this.setState({comment: e.target.value})}
onKeyDown={e =>
e.key == 'Enter' && this.onCommentSubmitted(this.state.comment)
}
autoFocus={true}
/> />
</Row>, </Row>,
<Row> <Row>