From 22af8f756396c05c86f082da23ecfc866cedb0e3 Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 3 Oct 2022 09:40:30 +0200 Subject: [PATCH] Fix clicking bookmark column header not scrolling to top in single-column --- .../flavours/glitch/features/ui/components/column.js | 5 +++-- 1 file 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;