about summary refs log tree commit diff
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-10-03 09:40:30 +0200
committerClaire <claire.github-309c@sitedethib.com>2022-10-03 09:54:24 +0200
commit22af8f756396c05c86f082da23ecfc866cedb0e3 (patch)
treefca6cc54289197b9329989081b9e1bff2c3b2404
parentb76cef6212a84cb9fd4ce241aaf3aeab5e1f07ac (diff)
Fix clicking bookmark column header not scrolling to top in single-column
-rw-r--r--app/javascript/flavours/glitch/features/ui/components/column.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/javascript/flavours/glitch/features/ui/components/column.js b/app/javascript/flavours/glitch/features/ui/components/column.js
index ab78414e0..916396931 100644
--- a/app/javascript/flavours/glitch/features/ui/components/column.js
+++ b/app/javascript/flavours/glitch/features/ui/components/column.js
@@ -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;