]> cat aescling's git repositories - mastodon.git/commitdiff
Fix clicking bookmark column header not scrolling to top in single-column
authorClaire <claire.github-309c@sitedethib.com>
Mon, 3 Oct 2022 07:40:30 +0000 (09:40 +0200)
committeraescling <aescling+gitlab@cat.family>
Thu, 17 Nov 2022 05:28:23 +0000 (00:28 -0500)
app/javascript/flavours/glitch/features/ui/components/column.js

index ab78414e0567485027e856c2e8a7a81d8bdfcffe..9163969315e30e3dc004b0fdb5f2d2246190a548 100644 (file)
@@ -14,10 +14,11 @@ export default class Column extends React.PureComponent {
     active: PropTypes.bool,
     hideHeadingOnMobile: PropTypes.bool,
     name: PropTypes.string,
+    bindToDocument: PropTypes.bool,
   };
 
   handleHeaderClick = () => {
-    const scrollable = this.node.querySelector('.scrollable');
+    const scrollable = this.props.bindToDocument ? document.scrollingElement : this.node.querySelector('.scrollable');
 
     if (!scrollable) {
       return;
@@ -27,7 +28,7 @@ export default class Column extends React.PureComponent {
   }
 
   scrollTop () {
-    const scrollable = this.node.querySelector('.scrollable');
+    const scrollable = this.props.bindToDocument ? document.scrollingElement : this.node.querySelector('.scrollable');
 
     if (!scrollable) {
       return;