refactor: Replace react-hotkeys with custom hook (#35425)

This commit is contained in:
diondiondion 2025-07-21 16:43:38 +02:00 committed by GitHub
parent fab95b8dae
commit 4de5cbd6f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 540 additions and 146 deletions

View file

@ -10,10 +10,9 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { connect } from 'react-redux';
import { HotKeys } from 'react-hotkeys';
import VisibilityIcon from '@/material-icons/400-24px/visibility.svg?react';
import VisibilityOffIcon from '@/material-icons/400-24px/visibility_off.svg?react';
import { Hotkeys } from 'mastodon/components/hotkeys';
import { Icon } from 'mastodon/components/icon';
import { LoadingIndicator } from 'mastodon/components/loading_indicator';
import { TimelineHint } from 'mastodon/components/timeline_hint';
@ -616,7 +615,7 @@ class Status extends ImmutablePureComponent {
<div className={classNames('scrollable', { fullscreen })} ref={this.setContainerRef}>
{ancestors}
<HotKeys handlers={handlers}>
<Hotkeys handlers={handlers}>
<div className={classNames('focusable', 'detailed-status__wrapper', `detailed-status__wrapper-${status.get('visibility')}`)} tabIndex={0} aria-label={textForScreenReader(intl, status, false)} ref={this.setStatusRef}>
<DetailedStatus
key={`details-${status.get('id')}`}
@ -654,7 +653,7 @@ class Status extends ImmutablePureComponent {
onEmbed={this.handleEmbed}
/>
</div>
</HotKeys>
</Hotkeys>
{descendants}
{remoteHint}