this.setState({ suggestionsHidden: true, focused: false });
}
- onFocus = () => {
+ onFocus = (e) => {
this.setState({ focused: true });
+ if (this.props.onFocus) {
+ this.props.onFocus(e);
+ }
}
onSuggestionClick = (e) => {
export default @injectIntl
class ComposeForm extends ImmutablePureComponent {
+ setRef = c => {
+ this.composeForm = c;
+ };
+
static contextTypes = {
router: PropTypes.object,
};
this.props.onChangeSpoilerText(e.target.value);
}
+ handleFocus = () => {
+ this.composeForm.scrollIntoView();
+ }
+
componentDidUpdate (prevProps) {
// This statement does several things:
// - If we're beginning a reply, and,
}
return (
- <div className='compose-form'>
+ <div className='compose-form' ref={this.setRef}>
<WarningContainer />
<ReplyIndicatorContainer />
value={this.props.text}
onChange={this.handleChange}
suggestions={this.props.suggestions}
+ onFocus={this.handleFocus}
onKeyDown={this.handleKeyDown}
onSuggestionsFetchRequested={this.onSuggestionsFetchRequested}
onSuggestionsClearRequested={this.onSuggestionsClearRequested}