]> cat aescling's git repositories - mastodon.git/commitdiff
Do not scroll in the compose panel on single-column
authorThibaut Girka <thib@sitedethib.com>
Sun, 16 Jun 2019 14:02:26 +0000 (16:02 +0200)
committerThibG <thib@sitedethib.com>
Sun, 16 Jun 2019 17:13:22 +0000 (19:13 +0200)
app/javascript/flavours/glitch/features/compose/components/compose_form.js
app/javascript/flavours/glitch/features/ui/components/compose_panel.js

index 5e73d7651d259285f73202328e39f20de0ee98c4..cbce675d538dba3f728662e7aef52523fdcebc84 100644 (file)
@@ -55,6 +55,7 @@ class ComposeForm extends ImmutablePureComponent {
     onPickEmoji: PropTypes.func,
     showSearch: PropTypes.bool,
     anyMedia: PropTypes.bool,
+    singleColumn: PropTypes.bool,
 
     advancedOptions: ImmutablePropTypes.map,
     layout: PropTypes.string,
@@ -195,7 +196,7 @@ class ComposeForm extends ImmutablePureComponent {
   }
 
   handleFocus = () => {
-    if (this.composeForm) {
+    if (this.composeForm && !this.props.singleColumn) {
       this.composeForm.scrollIntoView();
     }
   }
@@ -219,6 +220,7 @@ class ComposeForm extends ImmutablePureComponent {
       preselectDate,
       text,
       preselectOnReply,
+      singleColumn,
     } = this.props;
     let selectionEnd, selectionStart;
 
@@ -238,7 +240,7 @@ class ComposeForm extends ImmutablePureComponent {
       if (textarea) {
         textarea.setSelectionRange(selectionStart, selectionEnd);
         textarea.focus();
-        textarea.scrollIntoView();
+        if (!singleColumn) textarea.scrollIntoView();
       }
 
     //  Refocuses the textarea after submitting.
index f5eefee0d631714f938df0a02792198d6834e5a8..498f09ab6873fc14b0e60868bba0be2442b371aa 100644 (file)
@@ -8,7 +8,7 @@ const ComposePanel = () => (
   <div className='compose-panel'>
     <SearchContainer openInRoute />
     <NavigationContainer />
-    <ComposeFormContainer />
+    <ComposeFormContainer singleColumn />
     <LinkFooter withHotkeys />
   </div>
 );