Accessibility: Ensure focus order of post elements matches visual reading order (#39169)
This commit is contained in:
parent
1962e4743c
commit
d20d049226
@ -20,7 +20,8 @@ export interface StatusHeaderProps {
|
||||
status: Status;
|
||||
account?: Account;
|
||||
avatarSize?: number;
|
||||
children?: ReactNode;
|
||||
contentBeforeDate?: ReactNode;
|
||||
contentAfterDate?: ReactNode;
|
||||
wrapperProps?: HTMLAttributes<HTMLDivElement>;
|
||||
displayNameProps?: DisplayNameProps;
|
||||
onHeaderClick?: MouseEventHandler<HTMLDivElement>;
|
||||
@ -33,10 +34,11 @@ export type StatusHeaderRenderFn = (args: StatusHeaderProps) => ReactNode;
|
||||
export const StatusHeader: FC<StatusHeaderProps> = ({
|
||||
status,
|
||||
account,
|
||||
children,
|
||||
className,
|
||||
avatarSize = 48,
|
||||
wrapperProps,
|
||||
contentBeforeDate,
|
||||
contentAfterDate,
|
||||
onHeaderClick,
|
||||
}) => {
|
||||
const statusAccount = status.get('account') as Account | undefined;
|
||||
@ -51,6 +53,14 @@ export const StatusHeader: FC<StatusHeaderProps> = ({
|
||||
className={classNames('status__info', className)}
|
||||
/* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */
|
||||
>
|
||||
<StatusDisplayName
|
||||
statusAccount={statusAccount}
|
||||
friendAccount={account}
|
||||
avatarSize={avatarSize}
|
||||
/>
|
||||
|
||||
{contentBeforeDate}
|
||||
|
||||
<Link
|
||||
to={`/@${statusAccount?.acct}/${status.get('id') as string}`}
|
||||
className='status__relative-time'
|
||||
@ -60,13 +70,7 @@ export const StatusHeader: FC<StatusHeaderProps> = ({
|
||||
{editedAt && <StatusEditedAt editedAt={editedAt} />}
|
||||
</Link>
|
||||
|
||||
<StatusDisplayName
|
||||
statusAccount={statusAccount}
|
||||
friendAccount={account}
|
||||
avatarSize={avatarSize}
|
||||
/>
|
||||
|
||||
{children}
|
||||
{contentAfterDate}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@ -225,17 +225,20 @@ export const QuotedStatus: React.FC<QuotedStatusProps> = ({
|
||||
const intl = useIntl();
|
||||
const headerRenderFn: StatusHeaderRenderFn = useCallback(
|
||||
(props) => (
|
||||
<StatusHeader {...props}>
|
||||
{onQuoteCancel && (
|
||||
<IconButton
|
||||
onClick={onQuoteCancel}
|
||||
className='status__quote-cancel'
|
||||
title={intl.formatMessage(quoteCancelMessage)}
|
||||
icon='cancel-fill'
|
||||
iconComponent={CancelFillIcon}
|
||||
/>
|
||||
)}
|
||||
</StatusHeader>
|
||||
<StatusHeader
|
||||
{...props}
|
||||
contentAfterDate={
|
||||
onQuoteCancel && (
|
||||
<IconButton
|
||||
onClick={onQuoteCancel}
|
||||
className='status__quote-cancel'
|
||||
title={intl.formatMessage(quoteCancelMessage)}
|
||||
icon='cancel-fill'
|
||||
iconComponent={CancelFillIcon}
|
||||
/>
|
||||
)
|
||||
}
|
||||
/>
|
||||
),
|
||||
[intl, onQuoteCancel],
|
||||
);
|
||||
|
||||
@ -22,18 +22,22 @@ export const renderPinnedStatusHeader: StatusHeaderRenderFn = ({
|
||||
return <StatusHeader {...args} />;
|
||||
}
|
||||
return (
|
||||
<StatusHeader {...args} className={classes.pinnedStatusHeader}>
|
||||
<Badge
|
||||
className={classes.pinnedBadge}
|
||||
icon={<Icon id='pinned' icon={IconPinned} />}
|
||||
label={
|
||||
<FormattedMessage
|
||||
id='account.timeline.pinned'
|
||||
defaultMessage='Pinned'
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</StatusHeader>
|
||||
<StatusHeader
|
||||
{...args}
|
||||
className={classes.pinnedStatusHeader}
|
||||
contentBeforeDate={
|
||||
<Badge
|
||||
className={classes.pinnedBadge}
|
||||
icon={<Icon id='pinned' icon={IconPinned} />}
|
||||
label={
|
||||
<FormattedMessage
|
||||
id='account.timeline.pinned'
|
||||
defaultMessage='Pinned'
|
||||
/>
|
||||
}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@ -126,4 +126,7 @@
|
||||
|
||||
.pinnedBadge {
|
||||
justify-self: end;
|
||||
|
||||
// Allow "click to open post" event to pass through
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@ -1613,7 +1613,6 @@ body > [data-popper-placement] {
|
||||
font-size: 15px;
|
||||
line-height: 22px;
|
||||
height: 40px;
|
||||
order: 2;
|
||||
flex: 0 0 auto;
|
||||
color: var(--color-text-secondary);
|
||||
}
|
||||
@ -1666,7 +1665,6 @@ body > [data-popper-placement] {
|
||||
|
||||
.status__quote-cancel {
|
||||
align-self: self-start;
|
||||
order: 5;
|
||||
}
|
||||
|
||||
.status__info {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user