0
0
Fork 0

Fix compose form behavior in mobile view (#15555)

* Fix ComposeForm being mounted twice in mobile view

Fixes #13094

* Fix compose form focus and pre-selection behavior in mobile view

* Split _updateFocusAndSelection out of componentDidUpdate
This commit is contained in:
Claire 2021-03-24 10:19:07 +01:00 committed by GitHub
parent 49814d5799
commit 034f37b85a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 2 deletions

View file

@ -132,7 +132,15 @@ class ComposeForm extends ImmutablePureComponent {
}
}
componentDidMount () {
this._updateFocusAndSelection({ });
}
componentDidUpdate (prevProps) {
this._updateFocusAndSelection(prevProps);
}
_updateFocusAndSelection = (prevProps) => {
// This statement does several things:
// - If we're beginning a reply, and,
// - Replying to zero or one users, places the cursor at the end of the textbox.