[Accessibility] Navigation focus handling polish (#39358)

This commit is contained in:
diondiondion authored and GitHub committed 2026-06-10 14:50:49 +00:00
1 parent c6e2e2255c
commit 2994e8543d
27 files changed
+119 -48

No files matched your search

@@ -3,11 +3,10 @@ import { PureComponent } from 'react';
import { defineMessages, FormattedMessage } from 'react-intl';
import { List as ImmutableList } from 'immutable';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux';
import { Button } from 'mastodon/components/button';
import { NavigationFocusTarget } from 'mastodon/components/navigation_focus_target';
import { injectIntl } from '@/mastodon/components/intl';
import Option from './components/option';
@@ -84,7 +83,9 @@ class Category extends PureComponent {
return (
<>
<h3 className='report-dialog-modal__title'><FormattedMessage id='report.category.title' defaultMessage="Tell us what's going on with this {type}" values={{ type: intl.formatMessage(messages[startedFrom]) }} /></h3>
<NavigationFocusTarget as='h1' className='report-dialog-modal__title'>
<FormattedMessage id='report.category.title' defaultMessage="Tell us what's going on with this {type}" values={{ type: intl.formatMessage(messages[startedFrom]) }} />
</NavigationFocusTarget>
<p className='report-dialog-modal__lead'><FormattedMessage id='report.category.subtitle' defaultMessage='Choose the best match' /></p>
<div>
@@ -7,6 +7,7 @@ import { OrderedSet } from 'immutable';
import { shallowEqual } from 'react-redux';
import { Toggle } from '@/mastodon/components/form_fields/toggle_field';
import { NavigationFocusTarget } from '@/mastodon/components/navigation_focus_target';
import { fetchAccount } from 'mastodon/actions/accounts';
import { Button } from 'mastodon/components/button';
import type { Status } from 'mastodon/models/status';
@@ -148,14 +149,18 @@ const Comment: React.FC<Props> = ({
return (
<>
<h3 className='report-dialog-modal__title' id={titleId}>
<NavigationFocusTarget
as='h1'
id={titleId}
className='report-dialog-modal__title'
>
{modalTitle ?? (
<FormattedMessage
id='report.comment.title'
defaultMessage='Is there anything else you think we should know?'
/>
)}
</h3>
</NavigationFocusTarget>
<textarea
className='report-dialog-modal__textarea'
@@ -7,6 +7,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux';
import { Button } from 'mastodon/components/button';
import { NavigationFocusTarget } from 'mastodon/components/navigation_focus_target';
import Option from './components/option';
@@ -40,7 +41,9 @@ class Rules extends PureComponent {
return (
<>
<h3 className='report-dialog-modal__title'><FormattedMessage id='report.rules.title' defaultMessage='Which rules are being violated?' /></h3>
<NavigationFocusTarget as='h1' className='report-dialog-modal__title'>
<FormattedMessage id='report.rules.title' defaultMessage='Which rules are being violated?' />
</NavigationFocusTarget>
<p className='report-dialog-modal__lead'><FormattedMessage id='report.rules.subtitle' defaultMessage='Select all that apply' /></p>
<div>
@@ -10,6 +10,7 @@ import { connect } from 'react-redux';
import { Button } from 'mastodon/components/button';
import { LoadingIndicator } from 'mastodon/components/loading_indicator';
import StatusCheckBox from 'mastodon/features/report/containers/status_check_box_container';
import { NavigationFocusTarget } from '@/mastodon/components/navigation_focus_target';
const mapStateToProps = (state, { accountId }) => ({
availableStatusIds: OrderedSet(state.getIn(['timelines', `account:${accountId}:with_replies`, 'items'])),
@@ -37,7 +38,9 @@ class Statuses extends PureComponent {
return (
<>
<h3 className='report-dialog-modal__title'><FormattedMessage id='report.statuses.title' defaultMessage='Are there any posts that back up this report?' /></h3>
<NavigationFocusTarget as='h1' className='report-dialog-modal__title'>
<FormattedMessage id='report.statuses.title' defaultMessage='Are there any posts that back up this report?' />
</NavigationFocusTarget>
<p className='report-dialog-modal__lead'><FormattedMessage id='report.statuses.subtitle' defaultMessage='Select all that apply' /></p>
<div className='report-dialog-modal__statuses'>
@@ -12,6 +12,7 @@ import {
blockAccount,
} from 'mastodon/actions/accounts';
import { Button } from 'mastodon/components/button';
import { NavigationFocusTarget } from 'mastodon/components/navigation_focus_target';
const mapStateToProps = () => ({});
@@ -52,7 +53,9 @@ class Thanks extends PureComponent {
return (
<>
<h3 className='report-dialog-modal__title'>{submitted ? <FormattedMessage id='report.thanks.title_actionable' defaultMessage="Thanks for reporting, we'll look into this." /> : <FormattedMessage id='report.thanks.title' defaultMessage="Don't want to see this?" />}</h3>
<NavigationFocusTarget as='h1' className='report-dialog-modal__title'>
{submitted ? <FormattedMessage id='report.thanks.title_actionable' defaultMessage="Thanks for reporting, we'll look into this." /> : <FormattedMessage id='report.thanks.title' defaultMessage="Don't want to see this?" />}
</NavigationFocusTarget>
<p className='report-dialog-modal__lead'>{submitted ? <FormattedMessage id='report.thanks.take_action_actionable' defaultMessage='While we review this, you can take action against @{name}:' values={{ name: account.get('username') }} /> : <FormattedMessage id='report.thanks.take_action' defaultMessage='Here are your options for controlling what you see on Mastodon:' />}</p>
{account.getIn(['relationship', 'following']) && (