From e90649b0641910225e04e308e59297f8c91b96a8 Mon Sep 17 00:00:00 2001
From: Claire <claire.github-309c@sitedethib.com>
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 <Plastikmensch@users.noreply.github.com>
---
 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 7e7eaa411..d737bd347 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;