From adfc894a1f70ed108475ea0448083377578cc388 Mon Sep 17 00:00:00 2001 From: diondiondion Date: Wed, 10 Jun 2026 16:50:49 +0200 Subject: [PATCH] [Glitch] Navigation focus handling polish Port 2994e8543deec8fb3c4228afd7c556a37904662f to glitch-soc Signed-off-by: Claire --- .../flavours/glitch/actions/compose.js | 7 +++++-- .../glitch/components/account_header/name.tsx | 5 +++-- .../alt_text_modal/__tests__/index-test.tsx | 12 +++++++++--- .../glitch/features/alt_text_modal/index.tsx | 8 ++++++-- .../glitch/features/annual_report/index.tsx | 5 ++++- .../glitch/features/collection_adder/index.tsx | 9 +++++++-- .../glitch/features/custom_homepage/index.tsx | 5 ++++- .../glitch/features/filters/added_to_filter.jsx | 5 ++++- .../glitch/features/filters/select_filter.jsx | 5 ++++- .../glitch/features/list_adder/index.tsx | 5 +++-- .../glitch/features/privacy_policy/index.tsx | 7 +++++-- .../flavours/glitch/features/report/category.jsx | 7 ++++--- .../flavours/glitch/features/report/comment.tsx | 9 +++++++-- .../flavours/glitch/features/report/rules.jsx | 5 ++++- .../flavours/glitch/features/report/statuses.jsx | 5 ++++- .../flavours/glitch/features/report/thanks.jsx | 5 ++++- .../glitch/features/terms_of_service/index.tsx | 7 +++++-- .../features/ui/components/block_modal.jsx | 5 ++++- .../features/ui/components/boost_modal.tsx | 5 +++-- .../features/ui/components/dialog_modal.tsx | 5 ++++- .../ui/components/domain_block_modal.tsx | 5 +++-- .../features/ui/components/embed_modal.tsx | 5 +++-- .../ui/components/ignore_notifications_modal.jsx | 3 ++- .../glitch/features/ui/components/mute_modal.jsx | 5 ++++- .../ui/components/report_collection_modal.tsx | 5 +++-- .../features/ui/components/visibility_modal.tsx | 16 +++++++++------- .../glitch/styles/mastodon/components.scss | 2 ++ 27 files changed, 119 insertions(+), 48 deletions(-) diff --git a/app/javascript/flavours/glitch/actions/compose.js b/app/javascript/flavours/glitch/actions/compose.js index f7a923d38a..009f6014a8 100644 --- a/app/javascript/flavours/glitch/actions/compose.js +++ b/app/javascript/flavours/glitch/actions/compose.js @@ -98,7 +98,7 @@ const messages = defineMessages({ export const ensureComposeIsVisible = (getState) => { if (!getState().getIn(['compose', 'mounted'])) { - browserHistory.push('/publish'); + browserHistory.push('/publish', { focusTarget: false }); } }; @@ -318,7 +318,10 @@ export function submitCompose(overridePrivacy = null, successCallback = undefine message: statusId === null ? messages.published : messages.saved, action: messages.open, dismissAfter: 10000, - onClick: () => browserHistory.push(`/@${response.data.account.username}/${response.data.id}`), + onClick: () => browserHistory.push( + `/@${response.data.account.username}/${response.data.id}`, + { focusTarget: 'detailed-status' } + ), })); } }).catch(function (error) { diff --git a/app/javascript/flavours/glitch/components/account_header/name.tsx b/app/javascript/flavours/glitch/components/account_header/name.tsx index 01453c2b92..aca296c311 100644 --- a/app/javascript/flavours/glitch/components/account_header/name.tsx +++ b/app/javascript/flavours/glitch/components/account_header/name.tsx @@ -19,6 +19,7 @@ import { FollowsYouBadge } from '../badge'; import { CopyButton } from '../copy_button'; import { DisplayName } from '../display_name'; import { Icon } from '../icon'; +import { NavigationFocusTarget } from '../navigation_focus_target'; import { AccountBadges } from './badges'; import classes from './styles.module.scss'; @@ -56,9 +57,9 @@ export const AccountName: FC<{ accountId: string }> = ({ accountId }) => { return (
-

+ -

+ {relationship?.followed_by && }
diff --git a/app/javascript/flavours/glitch/features/alt_text_modal/__tests__/index-test.tsx b/app/javascript/flavours/glitch/features/alt_text_modal/__tests__/index-test.tsx index 616ce71c3d..6de6d74ab0 100644 --- a/app/javascript/flavours/glitch/features/alt_text_modal/__tests__/index-test.tsx +++ b/app/javascript/flavours/glitch/features/alt_text_modal/__tests__/index-test.tsx @@ -7,6 +7,8 @@ import { List, Map } from 'immutable'; import { render } from '@testing-library/react'; import { vi } from 'vitest'; +import { FocusTargetProvider } from '@/flavours/glitch/components/navigation_focus_target'; +import { Router } from '@/flavours/glitch/components/router'; import type { RootState } from 'flavours/glitch/store'; import { useAppSelector } from 'flavours/glitch/store'; @@ -27,9 +29,13 @@ describe('', () => { const renderComponent = () => { return render( - - - , + + + + + + + , ); }; diff --git a/app/javascript/flavours/glitch/features/alt_text_modal/index.tsx b/app/javascript/flavours/glitch/features/alt_text_modal/index.tsx index d19f653c0f..f9f09ef88d 100644 --- a/app/javascript/flavours/glitch/features/alt_text_modal/index.tsx +++ b/app/javascript/flavours/glitch/features/alt_text_modal/index.tsx @@ -22,6 +22,7 @@ import { changeUploadCompose } from 'flavours/glitch/actions/compose_typed'; import { Button } from 'flavours/glitch/components/button'; import { GIFV } from 'flavours/glitch/components/gifv'; import { LoadingIndicator } from 'flavours/glitch/components/loading_indicator'; +import { NavigationFocusTarget } from 'flavours/glitch/components/navigation_focus_target'; import { Skeleton } from 'flavours/glitch/components/skeleton'; import { Audio } from 'flavours/glitch/features/audio'; import { CharacterCounter } from 'flavours/glitch/features/compose/components/character_counter'; @@ -412,12 +413,15 @@ export const AltTextModal = forwardRef>( )} - + - +