Skip to content

Commit 4226f29

Browse files
committed
Fix hidden statuses losing focus
Fixes #10991
1 parent 4f5b221 commit 4226f29

1 file changed

Lines changed: 19 additions & 17 deletions

File tree

app/javascript/mastodon/components/status.js

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -278,12 +278,27 @@ class Status extends ImmutablePureComponent {
278278
return null;
279279
}
280280

281+
const handlers = this.props.muted ? {} : {
282+
reply: this.handleHotkeyReply,
283+
favourite: this.handleHotkeyFavourite,
284+
boost: this.handleHotkeyBoost,
285+
mention: this.handleHotkeyMention,
286+
open: this.handleHotkeyOpen,
287+
openProfile: this.handleHotkeyOpenProfile,
288+
moveUp: this.handleHotkeyMoveUp,
289+
moveDown: this.handleHotkeyMoveDown,
290+
toggleHidden: this.handleHotkeyToggleHidden,
291+
toggleSensitive: this.handleHotkeyToggleSensitive,
292+
};
293+
281294
if (hidden) {
282295
return (
283-
<div ref={this.handleRef}>
284-
{status.getIn(['account', 'display_name']) || status.getIn(['account', 'username'])}
285-
{status.get('content')}
286-
</div>
296+
<HotKeys handlers={handlers}>
297+
<div ref={this.handleRef} className={classNames('status__wrapper', { focusable: !this.props.muted })} tabIndex='0'>
298+
{status.getIn(['account', 'display_name']) || status.getIn(['account', 'username'])}
299+
{status.get('content')}
300+
</div>
301+
</HotKeys>
287302
);
288303
}
289304

@@ -394,19 +409,6 @@ class Status extends ImmutablePureComponent {
394409
statusAvatar = <AvatarOverlay account={status.get('account')} friend={account} />;
395410
}
396411

397-
const handlers = this.props.muted ? {} : {
398-
reply: this.handleHotkeyReply,
399-
favourite: this.handleHotkeyFavourite,
400-
boost: this.handleHotkeyBoost,
401-
mention: this.handleHotkeyMention,
402-
open: this.handleHotkeyOpen,
403-
openProfile: this.handleHotkeyOpenProfile,
404-
moveUp: this.handleHotkeyMoveUp,
405-
moveDown: this.handleHotkeyMoveDown,
406-
toggleHidden: this.handleHotkeyToggleHidden,
407-
toggleSensitive: this.handleHotkeyToggleSensitive,
408-
};
409-
410412
return (
411413
<HotKeys handlers={handlers}>
412414
<div className={classNames('status__wrapper', `status__wrapper-${status.get('visibility')}`, { 'status__wrapper-reply': !!status.get('in_reply_to_id'), read: unread === false, focusable: !this.props.muted })} tabIndex={this.props.muted ? null : 0} data-featured={featured ? 'true' : null} aria-label={textForScreenReader(intl, status, rebloggedByText)} ref={this.handleRef}>

0 commit comments

Comments
 (0)