Skip to content

Commit 2826d83

Browse files
chewy444Trancever
authored andcommitted
fix: appBar Accessibility Focus (#1544)
1 parent dc7b47e commit 2826d83

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/components/Appbar/AppbarContent.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ type Props = $RemoveChildren<typeof View> & {
3030
* Style for the title.
3131
*/
3232
titleStyle?: StyleProp<TextStyle>;
33+
/**
34+
* Reference for the title.
35+
*/
36+
titleRef?: React.RefObject<Text>;
3337
/**
3438
* Text for the subtitle.
3539
*/
@@ -62,6 +66,7 @@ class AppbarContent extends React.Component<Props> {
6266
subtitleStyle,
6367
onPress,
6468
style,
69+
titleRef,
6570
titleStyle,
6671
theme,
6772
title,
@@ -78,6 +83,7 @@ class AppbarContent extends React.Component<Props> {
7883
<TouchableWithoutFeedback onPress={onPress}>
7984
<View style={[styles.container, style]} {...rest}>
8085
<Text
86+
ref={titleRef}
8187
style={[
8288
{
8389
color: titleColor,
@@ -87,6 +93,7 @@ class AppbarContent extends React.Component<Props> {
8793
titleStyle,
8894
]}
8995
numberOfLines={1}
96+
accessible
9097
accessibilityTraits="header"
9198
// @ts-ignore
9299
accessibilityRole={Platform.OS === 'web' ? 'heading' : 'header'}

src/components/__tests__/Appbar/__snapshots__/Appbar.test.js.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ exports[`Appbar passes additional props to AppbarBackAction, AppbarContent and A
417417
<Text
418418
accessibilityRole="header"
419419
accessibilityTraits="header"
420+
accessible={true}
420421
numberOfLines={1}
421422
style={
422423
Array [

0 commit comments

Comments
 (0)