mirror of
https://github.com/mastodon/mastodon.git
synced 2026-08-24 23:44:45 -05:00
Also handle moving focus to main post in thread
This commit is contained in:
@@ -33,6 +33,7 @@ import StatusContent from './status_content';
|
||||
import { StatusThreadLabel } from './status_thread_label';
|
||||
import { CollectionPreviewCard } from '../features/collections/components/collection_preview_card';
|
||||
import { compareUrls } from '../utils/compare_urls';
|
||||
import { FOCUS_TARGET } from './navigation_focus_target';
|
||||
|
||||
const domParser = new DOMParser();
|
||||
|
||||
@@ -311,9 +312,9 @@ class Status extends ImmutablePureComponent {
|
||||
window.open(path, '_blank', 'noopener');
|
||||
} else {
|
||||
if (history.location.pathname.replace('/deck/', '/') === path) {
|
||||
history.replace(path);
|
||||
history.replace(path, {focusTarget: FOCUS_TARGET.POST});
|
||||
} else {
|
||||
history.push(path);
|
||||
history.push(path, {focusTarget: FOCUS_TARGET.POST});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -8,6 +8,7 @@ import type { List as ImmutableList, RecordOf } from 'immutable';
|
||||
|
||||
import type { ApiMentionJSON } from '@/mastodon/api_types/statuses';
|
||||
import { AnimateEmojiProvider } from '@/mastodon/components/emoji/context';
|
||||
import { FOCUS_TARGET } from '@/mastodon/components/navigation_focus_target';
|
||||
import BarChart4BarsIcon from '@/material-icons/400-24px/bar_chart_4_bars.svg?react';
|
||||
import PhotoLibraryIcon from '@/material-icons/400-24px/photo_library.svg?react';
|
||||
import { toggleStatusSpoilers } from 'mastodon/actions/statuses';
|
||||
@@ -67,7 +68,7 @@ export const EmbeddedStatus: React.FC<{ statusId: string }> = ({
|
||||
const path = `/@${account.acct}/${statusId}`;
|
||||
|
||||
if (button === 0 && !(ctrlKey || metaKey)) {
|
||||
history.push(path);
|
||||
history.push(path, { focusTarget: FOCUS_TARGET.POST });
|
||||
} else if (button === 1 || (button === 0 && (ctrlKey || metaKey))) {
|
||||
window.open(path, '_blank', 'noopener');
|
||||
}
|
||||
|
||||
@@ -72,6 +72,7 @@ import ActionBar from './components/action_bar';
|
||||
import { DetailedStatus } from './components/detailed_status';
|
||||
import { RefreshController } from './components/refresh_controller';
|
||||
import { quoteComposeById } from '@/mastodon/actions/compose_typed';
|
||||
import { FOCUS_TARGET, NavigationFocusTarget } from '@/mastodon/components/navigation_focus_target';
|
||||
|
||||
const messages = defineMessages({
|
||||
revealAll: { id: 'status.show_more_all', defaultMessage: 'Show more for all' },
|
||||
@@ -585,7 +586,13 @@ class Status extends ImmutablePureComponent {
|
||||
{ancestors}
|
||||
|
||||
<Hotkeys handlers={handlers}>
|
||||
<div className={classNames('focusable', 'detailed-status__wrapper', `detailed-status__wrapper-${status.get('visibility')}`)} tabIndex={0} aria-label={textForScreenReader({intl, status})} ref={this.setStatusRef}>
|
||||
<NavigationFocusTarget
|
||||
as='div'
|
||||
focusTargetName={FOCUS_TARGET.POST}
|
||||
className={classNames('focusable', 'detailed-status__wrapper', `detailed-status__wrapper-${status.get('visibility')}`)}
|
||||
tabIndex={0}
|
||||
aria-label={textForScreenReader({intl, status})} ref={this.setStatusRef}
|
||||
>
|
||||
<DetailedStatus
|
||||
key={`details-${status.get('id')}`}
|
||||
status={status}
|
||||
@@ -626,7 +633,7 @@ class Status extends ImmutablePureComponent {
|
||||
onPin={this.handlePin}
|
||||
onEmbed={this.handleEmbed}
|
||||
/>
|
||||
</div>
|
||||
</NavigationFocusTarget>
|
||||
</Hotkeys>
|
||||
|
||||
{descendants}
|
||||
|
||||
Reference in New Issue
Block a user