From 5ea53b6158c42660aa61da2a49a3bbf9e2e406d0 Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 24 Mar 2021 10:19:07 +0100 Subject: [Glitch] Fix compose form behavior in mobile view Port 034f37b85a716872f78a72048a5a225cdcaa840a to glitch-soc Signed-off-by: Claire --- .../glitch/features/compose/components/compose_form.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'app/javascript/flavours/glitch/features/compose/components') 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, -- cgit