From 71f9763e68a29fb4498d2f4c5f2621e6cf665b7c Mon Sep 17 00:00:00 2001 From: diondiondion Date: Mon, 9 Mar 2026 18:42:54 +0100 Subject: [PATCH] Fix erratic scroll-to-right on delete & redraft in Advanced UI (#38116) --- app/javascript/mastodon/components/router.tsx | 3 +++ .../mastodon/features/status/index.jsx | 7 +++++- app/javascript/mastodon/features/ui/index.jsx | 23 ++++++++++--------- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/app/javascript/mastodon/components/router.tsx b/app/javascript/mastodon/components/router.tsx index 1dc1d45083..1c251d6abc 100644 --- a/app/javascript/mastodon/components/router.tsx +++ b/app/javascript/mastodon/components/router.tsx @@ -17,6 +17,9 @@ import { isDevelopment } from 'mastodon/utils/environment'; interface MastodonLocationState { fromMastodon?: boolean; mastodonModalKey?: string; + // Prevent the rightmost column in advanced UI from scrolling + // into view on location changes + preventMultiColumnAutoScroll?: string; } export type LocationState = MastodonLocationState | null | undefined; diff --git a/app/javascript/mastodon/features/status/index.jsx b/app/javascript/mastodon/features/status/index.jsx index 77e8af4b67..a94c94492d 100644 --- a/app/javascript/mastodon/features/status/index.jsx +++ b/app/javascript/mastodon/features/status/index.jsx @@ -255,7 +255,12 @@ class Status extends ImmutablePureComponent { const { dispatch, history } = this.props; const handleDeleteSuccess = () => { - history.push('/'); + history.push('/', { + // Preventing the default "scroll to right" on + // location change in advanced UI to avoid conflict + // with the composer being focused + preventMultiColumnAutoScroll: true + }); }; if (!deleteModal) { diff --git a/app/javascript/mastodon/features/ui/index.jsx b/app/javascript/mastodon/features/ui/index.jsx index 55bc8f9901..47fe6ff0cc 100644 --- a/app/javascript/mastodon/features/ui/index.jsx +++ b/app/javascript/mastodon/features/ui/index.jsx @@ -136,7 +136,9 @@ class SwitchingColumnsArea extends PureComponent { } handleChildrenContentChange() { - if (!this.props.singleColumn) { + const {preventMultiColumnAutoScroll} = this.props.location.state ?? {}; + + if (!this.props.singleColumn && !preventMultiColumnAutoScroll) { const isRtlLayout = document.getElementsByTagName('body')[0] ?.classList.contains('rtl'); const modifier = isRtlLayout ? -1 : 1; @@ -156,24 +158,23 @@ class SwitchingColumnsArea extends PureComponent { const { signedIn } = this.props.identity; const pathName = this.props.location.pathname; - let redirect; - + let rootRedirect; if (signedIn) { if (forceOnboarding) { - redirect = ; + rootRedirect = '/start'; } else if (singleColumn) { - redirect = ; + rootRedirect = '/home'; } else { - redirect = ; + rootRedirect = '/deck/getting-started'; } } else if (singleUserMode && owner && initialState?.accounts[owner]) { - redirect = ; + rootRedirect = `/@${initialState.accounts[owner].username}`; } else if (trendsEnabled && landingPage === 'trends') { - redirect = ; + rootRedirect = '/explore'; } else if (localLiveFeedAccess === 'public' && landingPage === 'local_feed') { - redirect = ; + rootRedirect = '/public/local'; } else { - redirect = ; + rootRedirect = '/about'; } const profileRedesignRoutes = []; @@ -194,7 +195,7 @@ class SwitchingColumnsArea extends PureComponent { - {redirect} + {singleColumn ? : null} {singleColumn && pathName.startsWith('/deck/') ? : null}