From 685270f3f7ea6d4a8a48ec641e8fdfd9fc2e2d7f Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 24 Aug 2023 14:10:48 +0200 Subject: [PATCH] =?UTF-8?q?[Glitch]=20Fix=20clicking=20=E2=80=9CExplore?= =?UTF-8?q?=E2=80=9D=20or=20=E2=80=9CLive=20feeds=E2=80=9D=20column=20head?= =?UTF-8?q?ers=20to=20scroll=20in=20advanced=20mode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Port e90649b0641910225e04e308e59297f8c91b96a8 to glitch-soc Co-authored-by: Plastikmensch Signed-off-by: Claire --- .../flavours/glitch/components/column.jsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/javascript/flavours/glitch/components/column.jsx b/app/javascript/flavours/glitch/components/column.jsx index 312a6848b5..3c58130528 100644 --- a/app/javascript/flavours/glitch/components/column.jsx +++ b/app/javascript/flavours/glitch/components/column.jsx @@ -18,7 +18,19 @@ export default class Column extends PureComponent { }; scrollTop () { - const scrollable = this.props.bindToDocument ? document.scrollingElement : this.node.querySelector('.scrollable'); + let scrollable = null; + + if (this.props.bindToDocument) { + scrollable = document.scrollingElement; + } else { + scrollable = this.node.querySelector('.scrollable'); + + // Some columns have nested `.scrollable` containers, with the outer one + // being a wrapper while the actual scrollable content is deeper. + if (scrollable.classList.contains('scrollable--flex')) { + scrollable = scrollable?.querySelector('.scrollable') || scrollable; + } + } if (!scrollable) { return;