about summary refs log tree commit diff
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-06-16 16:02:26 +0200
committermultiple creatures <dev@multiple-creature.party>2020-02-22 01:31:14 -0600
commit402afc67c4e859c56cd84f2120d89c080812fa6d (patch)
tree0d71c56a164e02ed8d13ec457ce4999ee9cbcd52
parentef5ad472bb0108ca00af5f6b0f4dfff7dee04190 (diff)
Do not scroll in the compose panel on single-column
-rw-r--r--app/javascript/flavours/glitch/features/compose/components/compose_form.js6
-rw-r--r--app/javascript/flavours/glitch/features/ui/components/compose_panel.js2
2 files changed, 5 insertions, 3 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 3802ff796..c018f39d5 100644
--- a/app/javascript/flavours/glitch/features/compose/components/compose_form.js
+++ b/app/javascript/flavours/glitch/features/compose/components/compose_form.js
@@ -59,6 +59,7 @@ class ComposeForm extends ImmutablePureComponent {
     onPickEmoji: PropTypes.func,
     showSearch: PropTypes.bool,
     anyMedia: PropTypes.bool,
+    singleColumn: PropTypes.bool,
 
     advancedOptions: ImmutablePropTypes.map,
     layout: PropTypes.string,
@@ -205,7 +206,7 @@ class ComposeForm extends ImmutablePureComponent {
   }
 
   handleFocus = () => {
-    if (this.composeForm) {
+    if (this.composeForm && !this.props.singleColumn) {
       this.composeForm.scrollIntoView();
     }
   }
@@ -229,6 +230,7 @@ class ComposeForm extends ImmutablePureComponent {
       preselectDate,
       text,
       preselectOnReply,
+      singleColumn,
     } = this.props;
     let selectionEnd, selectionStart;
 
@@ -248,7 +250,7 @@ class ComposeForm extends ImmutablePureComponent {
       if (textarea) {
         textarea.setSelectionRange(selectionStart, selectionEnd);
         textarea.focus();
-        textarea.scrollIntoView();
+        if (!singleColumn) textarea.scrollIntoView();
       }
 
     //  Refocuses the textarea after submitting.
diff --git a/app/javascript/flavours/glitch/features/ui/components/compose_panel.js b/app/javascript/flavours/glitch/features/ui/components/compose_panel.js
index f5eefee0d..498f09ab6 100644
--- a/app/javascript/flavours/glitch/features/ui/components/compose_panel.js
+++ b/app/javascript/flavours/glitch/features/ui/components/compose_panel.js
@@ -8,7 +8,7 @@ const ComposePanel = () => (
   <div className='compose-panel'>
     <SearchContainer openInRoute />
     <NavigationContainer />
-    <ComposeFormContainer />
+    <ComposeFormContainer singleColumn />
     <LinkFooter withHotkeys />
   </div>
 );