From ee67aa9596ff5e11674d0a576a4ae46370059e89 Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 24 Aug 2023 14:10:48 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20clicking=20=E2=80=9CExplore=E2=80=9D=20or?= =?UTF-8?q?=20=E2=80=9CLive=20feeds=E2=80=9D=20column=20headers=20to=20scr?= =?UTF-8?q?oll=20in=20advanced=20mode=20(#26633)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Plastikmensch --- app/javascript/mastodon/components/column.jsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/javascript/mastodon/components/column.jsx b/app/javascript/mastodon/components/column.jsx index 7e7eaa4115a9b..d737bd347c69d 100644 --- a/app/javascript/mastodon/components/column.jsx +++ b/app/javascript/mastodon/components/column.jsx @@ -16,7 +16,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;