fix(a11y): avoid plain divs as button or tabs (#6084)

Co-authored-by: Hailey <me@haileyok.com>
This commit is contained in:
Cynthia
2024-11-03 18:18:27 +01:00
committed by GitHub
parent c580f20b53
commit ac9d910e1e
6 changed files with 22 additions and 7 deletions
+6 -2
View File
@@ -118,7 +118,10 @@ export function TabBar({
)
return (
<View testID={testID} style={[pal.view, styles.outer]}>
<View
testID={testID}
style={[pal.view, styles.outer]}
accessibilityRole="tablist">
<DraggableScrollView
testID={`${testID}-selector`}
horizontal={true}
@@ -135,7 +138,8 @@ export function TabBar({
onLayout={e => onItemLayout(e, i)}
style={styles.item}
hoverStyle={pal.viewLight}
onPress={() => onPressItem(i)}>
onPress={() => onPressItem(i)}
accessibilityRole="tab">
<View style={[styles.itemInner, selected && indicatorStyle]}>
<Text
emoji
+5 -3
View File
@@ -29,6 +29,7 @@ import {useComposerControls} from '#/state/shell/composer'
import {useMergedThreadgateHiddenReplies} from '#/state/threadgate-hidden-replies'
import {PostThreadFollowBtn} from '#/view/com/post-thread/PostThreadFollowBtn'
import {atoms as a, useTheme} from '#/alf'
import {InlineLinkText} from '#/components/Link'
import {AppModerationCause} from '#/components/Pills'
import {RichText} from '#/components/RichText'
import {SubtleWebHover} from '#/components/SubtleWebHover'
@@ -744,12 +745,13 @@ function ExpandedPostDetails({
&middot;
</NewText>
<NewText
<InlineLinkText
to="#"
label={_(msg`Translate`)}
style={[a.text_sm, pal.link]}
title={_(msg`Translate`)}
onPress={onTranslatePress}>
<Trans>Translate</Trans>
</NewText>
</InlineLinkText>
</>
)}
</View>
@@ -256,6 +256,7 @@ let PostCtrls = ({
requireAuth(() => onPressReply())
}
}}
accessibilityRole="button"
accessibilityLabel={plural(post.replyCount || 0, {
one: 'Reply (# reply)',
other: 'Reply (# replies)',
@@ -293,6 +294,7 @@ let PostCtrls = ({
testID="likeBtn"
style={btnStyle}
onPress={() => requireAuth(() => onPressToggleLike())}
accessibilityRole="button"
accessibilityLabel={
post.viewer?.like
? plural(post.likeCount || 0, {
@@ -332,6 +334,7 @@ let PostCtrls = ({
onShare()
}
}}
accessibilityRole="button"
accessibilityLabel={_(msg`Share`)}
accessibilityHint=""
hitSlop={POST_CTRL_HITSLOP}>