:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(phai): restore Max sidebar auto-scroll during streaming (#56884)
Richard Solomoue69f39e4311f
diff --git a/frontend/src/layout/navigation-3000/sidepanel/SidePanelContentContainer.tsx b/frontend/src/layout/navigation-3000/sidepanel/SidePanelContentContainer.tsxindex 20a6a4155250..6f80775b6c8e 100644--- a/frontend/src/layout/navigation-3000/sidepanel/SidePanelContentContainer.tsx+++ b/frontend/src/layout/navigation-3000/sidepanel/SidePanelContentContainer.tsx@@ -18,7 +18,7 @@ export function SidePanelContentContainer({contentClassName={contentClassName}styledScrollbarsclassName={cn(- 'h-full bg-surface-primary flex flex-col flex-1 overflow-y-auto focus-within:outline-none focus-within:ring-2 focus-within:ring-primary z-10',+ 'h-full bg-surface-primary flex flex-col flex-1 focus-within:outline-none focus-within:ring-2 focus-within:ring-primary z-10',className)}data-attr="side-panel-content"diff --git a/frontend/src/scenes/max/components/ThreadAutoScroller.tsx b/frontend/src/scenes/max/components/ThreadAutoScroller.tsxindex 3566d1a5ee71..f009e116c57b 100644--- a/frontend/src/scenes/max/components/ThreadAutoScroller.tsx+++ b/frontend/src/scenes/max/components/ThreadAutoScroller.tsx@@ -82,13 +82,16 @@ export function ThreadAutoScroller({ children }: { children: React.ReactNode }):})resizeObserver.observe(sentinelRef.current)- // Reset the user interaction if we've reached the bottom of the screen+ // Reset the user interaction if we've reached the bottom of the scroll container// eslint-disable-next-line compat/compat- const intersectionObserver = new IntersectionObserver(([entries]) => {- if (!scrollOrigin.current.programmatic && scrollOrigin.current.user && entries.isIntersecting) {- scrollOrigin.current.user = false- }- })+ const intersectionObserver = new IntersectionObserver(+ ([entries]) => {+ if (!scrollOrigin.current.programmatic && scrollOrigin.current.user && entries.isIntersecting) {+ scrollOrigin.current.user = false+ }+ },+ { root: scrollableContainer }+ )intersectionObserver.observe(sentinelRef.current)return () => {diff --git a/frontend/src/scenes/max/maxLogic.tsx b/frontend/src/scenes/max/maxLogic.tsxindex a4d29dd735c3..eea332d912d0 100644--- a/frontend/src/scenes/max/maxLogic.tsx+++ b/frontend/src/scenes/max/maxLogic.tsx@@ -670,16 +670,17 @@ export function getScrollableContainer(element?: Element | null): HTMLElement |if (!element) {return null}+ // Walk up the DOM and find the nearest ancestor that is actually scrollable.+ // This is more robust than checking for specific tags or attributes, because+ // wrapper components like ScrollableShadows place attributes on a non-scrollable+ // root while the actual scrollable element is a child (ScrollArea.Viewport).let current = element.parentElementwhile (current) {- if (current.tagName === 'MAIN') {- return current- }- if (current instanceof HTMLElement && current.dataset.attr === 'side-panel-content') {- return current- }- if (current instanceof HTMLElement && current.dataset.attr === 'max-scrollable') {- return current+ if (current instanceof HTMLElement) {+ const { overflowY } = getComputedStyle(current)+ if (overflowY === 'auto' || overflowY === 'scroll') {+ return current+ }}current = current.parentElement}