about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features/compose/components
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2021-03-24 10:19:07 +0100
committerClaire <claire.github-309c@sitedethib.com>2021-03-24 11:21:21 +0100
commit5ea53b6158c42660aa61da2a49a3bbf9e2e406d0 (patch)
treef3f15ea30de78e0fabaa5135a3b3c7b51053e4b6 /app/javascript/flavours/glitch/features/compose/components
parentb61e44461cffb887556e20ba5a07caef72133e10 (diff)
[Glitch] Fix compose form behavior in mobile view
Port 034f37b85a716872f78a72048a5a225cdcaa840a to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours/glitch/features/compose/components')
-rw-r--r--app/javascript/flavours/glitch/features/compose/components/compose_form.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/features/compose/components/compose_form.js b/app/javascript/flavours/glitch/features/compose/components/compose_form.js
index 164f4a960..d4804a3c2 100644
--- a/app/javascript/flavours/glitch/features/compose/components/compose_form.js
+++ b/app/javascript/flavours/glitch/features/compose/components/compose_form.js
@@ -199,6 +199,14 @@ class ComposeForm extends ImmutablePureComponent {
     }
   }
 
+  componentDidMount () {
+    this._updateFocusAndSelection({ });
+  }
+
+  componentDidUpdate (prevProps) {
+    this._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
@@ -206,7 +214,7 @@ class ComposeForm extends ImmutablePureComponent {
   //      - Replying to more than one user, selects any usernames past
   //        the first; this provides a convenient shortcut to drop
   //        everyone else from the conversation.
-  componentDidUpdate (prevProps) {
+   _updateFocusAndSelection = (prevProps) => {
     const {
       textarea,
       spoilerText,