From 7e57d00af6c7248139dbaf8ea20e49928bd17bfd Mon Sep 17 00:00:00 2001 From: diondiondion Date: Mon, 9 Mar 2026 18:42:54 +0100 Subject: [PATCH] [Glitch] Fix erratic scroll-to-right on delete & redraft in Advanced UI Port 71f9763e68a29fb4498d2f4c5f2621e6cf665b7c to glitch-soc Signed-off-by: Claire --- .../flavours/glitch/components/router.tsx | 3 +++ .../flavours/glitch/features/status/index.jsx | 7 +++++- .../flavours/glitch/features/ui/index.jsx | 23 ++++++++++--------- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/app/javascript/flavours/glitch/components/router.tsx b/app/javascript/flavours/glitch/components/router.tsx index f027d6cd35..14cf0832fc 100644 --- a/app/javascript/flavours/glitch/components/router.tsx +++ b/app/javascript/flavours/glitch/components/router.tsx @@ -17,6 +17,9 @@ import { isDevelopment } from 'flavours/glitch/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/flavours/glitch/features/status/index.jsx b/app/javascript/flavours/glitch/features/status/index.jsx index 95cd925522..a1f8103910 100644 --- a/app/javascript/flavours/glitch/features/status/index.jsx +++ b/app/javascript/flavours/glitch/features/status/index.jsx @@ -286,7 +286,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/flavours/glitch/features/ui/index.jsx b/app/javascript/flavours/glitch/features/ui/index.jsx index f058f81a83..1fa24881b1 100644 --- a/app/javascript/flavours/glitch/features/ui/index.jsx +++ b/app/javascript/flavours/glitch/features/ui/index.jsx @@ -144,7 +144,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; @@ -164,24 +166,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 = []; @@ -202,7 +203,7 @@ class SwitchingColumnsArea extends PureComponent { - {redirect} + {singleColumn ? : null} {singleColumn && pathName.startsWith('/deck/') ? : null}