Improve a11y on noty feed (#4842)
parent
35165e3d9b
commit
043e5cea64
|
@ -206,7 +206,22 @@ let FeedItem = ({
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
let formattedCount = authors.length > 1 ? formatCount(authors.length - 1) : ''
|
const formattedCount =
|
||||||
|
authors.length > 1 ? formatCount(authors.length - 1) : ''
|
||||||
|
const firstAuthorName = sanitizeDisplayName(
|
||||||
|
authors[0].profile.displayName || authors[0].profile.handle,
|
||||||
|
)
|
||||||
|
const niceTimestamp = niceDate(item.notification.indexedAt)
|
||||||
|
const a11yLabelUsers =
|
||||||
|
authors.length > 1
|
||||||
|
? _(msg` and `) +
|
||||||
|
plural(authors.length - 1, {
|
||||||
|
one: `${formattedCount} other`,
|
||||||
|
other: `${formattedCount} others`,
|
||||||
|
})
|
||||||
|
: ''
|
||||||
|
const a11yLabel = `${firstAuthorName}${a11yLabelUsers} ${action} ${niceTimestamp}`
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Link
|
<Link
|
||||||
testID={`feedItem-by-${item.notification.author.handle}`}
|
testID={`feedItem-by-${item.notification.author.handle}`}
|
||||||
|
@ -223,6 +238,8 @@ let FeedItem = ({
|
||||||
]}
|
]}
|
||||||
href={itemHref}
|
href={itemHref}
|
||||||
noFeedback
|
noFeedback
|
||||||
|
accessibilityHint=""
|
||||||
|
accessibilityLabel={a11yLabel}
|
||||||
accessible={!isAuthorsExpanded}
|
accessible={!isAuthorsExpanded}
|
||||||
accessibilityActions={
|
accessibilityActions={
|
||||||
authors.length > 1
|
authors.length > 1
|
||||||
|
@ -270,16 +287,15 @@ let FeedItem = ({
|
||||||
showDmButton={item.type === 'starterpack-joined'}
|
showDmButton={item.type === 'starterpack-joined'}
|
||||||
/>
|
/>
|
||||||
<ExpandedAuthorsList visible={isAuthorsExpanded} authors={authors} />
|
<ExpandedAuthorsList visible={isAuthorsExpanded} authors={authors} />
|
||||||
<Text style={[styles.meta, a.self_start]}>
|
<Text
|
||||||
|
style={[styles.meta, a.self_start]}
|
||||||
|
accessibilityHint=""
|
||||||
|
accessibilityLabel={a11yLabel}>
|
||||||
<TextLink
|
<TextLink
|
||||||
key={authors[0].href}
|
key={authors[0].href}
|
||||||
style={[pal.text, s.bold]}
|
style={[pal.text, s.bold]}
|
||||||
href={authors[0].href}
|
href={authors[0].href}
|
||||||
text={forceLTR(
|
text={forceLTR(firstAuthorName)}
|
||||||
sanitizeDisplayName(
|
|
||||||
authors[0].profile.displayName || authors[0].profile.handle,
|
|
||||||
),
|
|
||||||
)}
|
|
||||||
disableMismatchWarning
|
disableMismatchWarning
|
||||||
/>
|
/>
|
||||||
{authors.length > 1 ? (
|
{authors.length > 1 ? (
|
||||||
|
@ -301,7 +317,7 @@ let FeedItem = ({
|
||||||
{({timeElapsed}) => (
|
{({timeElapsed}) => (
|
||||||
<Text
|
<Text
|
||||||
style={[pal.textLight, styles.pointer]}
|
style={[pal.textLight, styles.pointer]}
|
||||||
title={niceDate(item.notification.indexedAt)}>
|
title={niceTimestamp}>
|
||||||
{' ' + timeElapsed}
|
{' ' + timeElapsed}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
|
@ -453,7 +469,6 @@ function CondensedAuthorsList({
|
||||||
profile={authors[0].profile}
|
profile={authors[0].profile}
|
||||||
moderation={authors[0].moderation.ui('avatar')}
|
moderation={authors[0].moderation.ui('avatar')}
|
||||||
type={authors[0].profile.associated?.labeler ? 'labeler' : 'user'}
|
type={authors[0].profile.associated?.labeler ? 'labeler' : 'user'}
|
||||||
accessible={false}
|
|
||||||
/>
|
/>
|
||||||
{showDmButton ? <SayHelloBtn profile={authors[0].profile} /> : null}
|
{showDmButton ? <SayHelloBtn profile={authors[0].profile} /> : null}
|
||||||
</View>
|
</View>
|
||||||
|
@ -471,7 +486,6 @@ function CondensedAuthorsList({
|
||||||
profile={author.profile}
|
profile={author.profile}
|
||||||
moderation={author.moderation.ui('avatar')}
|
moderation={author.moderation.ui('avatar')}
|
||||||
type={author.profile.associated?.labeler ? 'labeler' : 'user'}
|
type={author.profile.associated?.labeler ? 'labeler' : 'user'}
|
||||||
accessible={false}
|
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
))}
|
))}
|
||||||
|
|
|
@ -55,7 +55,6 @@ interface PreviewableUserAvatarProps extends BaseUserAvatarProps {
|
||||||
profile: AppBskyActorDefs.ProfileViewBasic
|
profile: AppBskyActorDefs.ProfileViewBasic
|
||||||
disableHoverCard?: boolean
|
disableHoverCard?: boolean
|
||||||
onBeforePress?: () => void
|
onBeforePress?: () => void
|
||||||
accessible?: boolean
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const BLUR_AMOUNT = isWeb ? 5 : 100
|
const BLUR_AMOUNT = isWeb ? 5 : 100
|
||||||
|
@ -412,7 +411,6 @@ let PreviewableUserAvatar = ({
|
||||||
profile,
|
profile,
|
||||||
disableHoverCard,
|
disableHoverCard,
|
||||||
onBeforePress,
|
onBeforePress,
|
||||||
accessible = true,
|
|
||||||
...rest
|
...rest
|
||||||
}: PreviewableUserAvatarProps): React.ReactNode => {
|
}: PreviewableUserAvatarProps): React.ReactNode => {
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
|
@ -426,12 +424,8 @@ let PreviewableUserAvatar = ({
|
||||||
return (
|
return (
|
||||||
<ProfileHoverCard did={profile.did} disable={disableHoverCard}>
|
<ProfileHoverCard did={profile.did} disable={disableHoverCard}>
|
||||||
<Link
|
<Link
|
||||||
label={
|
label={_(msg`${profile.displayName || profile.handle}'s avatar`)}
|
||||||
accessible
|
accessibilityHint={_(msg`Opens this profile`)}
|
||||||
? _(msg`${profile.displayName || profile.handle}'s avatar`)
|
|
||||||
: undefined
|
|
||||||
}
|
|
||||||
accessibilityHint={accessible ? _(msg`Opens this profile`) : undefined}
|
|
||||||
to={makeProfileLink({
|
to={makeProfileLink({
|
||||||
did: profile.did,
|
did: profile.did,
|
||||||
handle: profile.handle,
|
handle: profile.handle,
|
||||||
|
|
Loading…
Reference in New Issue