Skip to content

Commit 6e887b4

Browse files
authored
Add support for accessibilityPosInSet and accessibilitySetSize to Fabric (#13518)
* Add Support for AccessibilityPosInSet * Change files * Format * Add testing * Fix Missing TestID * Add Props to Accessibility Tree Dumps * Update Fabric Snapshots * Update Touchable Example * Update Snapshotes
1 parent cd4edf7 commit 6e887b4

31 files changed

+2136
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "Add Support for AccessibilityPosInSet",
4+
"packageName": "react-native-windows",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}

packages/@react-native-windows/tester/overrides.json

+7
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@
6161
"baseHash": "c4d61d6e76488c48b8256e6abc9bb38ef8e54c44",
6262
"issue": 5688
6363
},
64+
{
65+
"type": "derived",
66+
"file": "src/js/examples/Touchable/TouchableExample.windows.js",
67+
"baseFile": "packages/rn-tester/js/examples/Touchable/TouchableExample.js",
68+
"baseHash": "b91360dda9abf5e2b6f5d6d6a258c7e6f9b0b4d8",
69+
"issue": 0
70+
},
6471
{
6572
"type": "patch",
6673
"file": "src/js/examples/TurboModule/SampleTurboModuleExample.windows.js",

packages/@react-native-windows/tester/src/js/examples-win/Button/ButtonExample.windows.js

+2
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ exports.examples = [
219219
accessibilityLabel="Press to submit your application!"
220220
accessibilityRole="Button"
221221
accessibilityHint="Submit Button"
222+
accessibilityPosInSet={1}
223+
accessibilitySetSize={1}
222224
/>
223225
);
224226
}}

packages/@react-native-windows/tester/src/js/examples-win/Switch/SwitchExample.windows.js

+8
Original file line numberDiff line numberDiff line change
@@ -292,13 +292,17 @@ class AccessibilitySwitchExample extends React.Component<
292292
<Switch
293293
accessibilityLabel="This is a Switch"
294294
accessibilityHint="Switch"
295+
accessibilityPosInSet={1}
296+
accessibilitySetSize={4}
295297
nativeID="accessibility-switch"
296298
onValueChange={value => this.setState({switchValue: value})}
297299
value={this.state.switchValue}
298300
/>
299301
<Switch
300302
accessibilityLabel="This is a Switch with focusable set to false"
301303
accessibilityHint="Switch"
304+
accessibilityPosInSet={2}
305+
accessibilitySetSize={4}
302306
// focusable={false}
303307
onValueChange={value => this.setState({noFocusableValue: value})}
304308
value={this.state.noFocusableValue}
@@ -308,13 +312,17 @@ class AccessibilitySwitchExample extends React.Component<
308312
<Switch
309313
accessibilityLabel="This is a Switch with accessible set to false"
310314
accessibilityHint="Switch"
315+
accessibilityPosInSet={3}
316+
accessibilitySetSize={4}
311317
// accessible={false}
312318
onValueChange={value => this.setState({noAccessibleValue: value})}
313319
value={this.state.noAccessibleValue}
314320
/>
315321
<Switch
316322
accessibilityLabel="This is a Switch with focusable and accessible set to false"
317323
accessibilityHint="Switch"
324+
accessibilityPosInSet={4}
325+
accessibilitySetSize={4}
318326
// focusable={false}
319327
// accessible={false}
320328
onValueChange={value => this.setState({noFocusValue: value})}

packages/@react-native-windows/tester/src/js/examples/ActivityIndicator/ActivityIndicatorExample.windows.js

+2
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ exports.examples = [
7777
color="white"
7878
testID="default_activity_indicator"
7979
accessibilityLabel="Wait for content to load!"
80+
accessibilityPosInSet={1}
81+
accessibilitySetSize={1}
8082
accessible
8183
/>
8284
);

packages/@react-native-windows/tester/src/js/examples/Image/ImageExample.windows.js

+25
Original file line numberDiff line numberDiff line change
@@ -1571,6 +1571,31 @@ exports.examples = [
15711571
);
15721572
},
15731573
},
1574+
{
1575+
title: 'Accessibility Position in Set and Accessibility Set Size',
1576+
description:
1577+
'When their are a set of elements the acessibilityPosInSet and accessibilitySetSize props should be used to alert UIA of the set structure',
1578+
render: function (): React.Node {
1579+
return (
1580+
<View accessible testID='image-set'>
1581+
<Image
1582+
source={fullImage}
1583+
style={styles.base}
1584+
accessible
1585+
accessibilityPosInSet={1}
1586+
accessibilitySetSize={2}
1587+
/>
1588+
<Image
1589+
source={fullImage}
1590+
style={styles.base}
1591+
accessible
1592+
accessibilityPosInSet={2}
1593+
accessibilitySetSize={2}
1594+
/>
1595+
</View>
1596+
);
1597+
},
1598+
},
15741599
{
15751600
title: 'Fade Duration',
15761601
description:

packages/@react-native-windows/tester/src/js/examples/Pressable/PressableExample.windows.js

+24
Original file line numberDiff line numberDiff line change
@@ -1038,6 +1038,30 @@ const examples = [
10381038
);
10391039
},
10401040
},
1041+
// [Windows
1042+
{
1043+
title: 'Set of Pressables',
1044+
description: 'Pressables can be defined as a set using accessibilityPosInSet and accessibilitySetSize',
1045+
render: function (): React.Node {
1046+
return (
1047+
<View accessible testID='pressable_set'>
1048+
<Pressable
1049+
onPress={() => {}} accessibilityPosInSet={1} accessibilitySetSize={3}>
1050+
<Text>Pressable 1 of 3</Text>
1051+
</Pressable>
1052+
<Pressable
1053+
onPress={() => {}} accessibilityPosInSet={2} accessibilitySetSize={3}>
1054+
<Text>Pressable 2 of 3</Text>
1055+
</Pressable>
1056+
<Pressable
1057+
onPress={() => {}} accessibilityPosInSet={3} accessibilitySetSize={3}>
1058+
<Text>Pressable 3 of 3</Text>
1059+
</Pressable>
1060+
</View>
1061+
);
1062+
},
1063+
},
1064+
// Windows]
10411065
];
10421066

10431067
if (ReactNativeFeatureFlags.shouldPressibilityUseW3CPointerEventsForHover()) {

packages/@react-native-windows/tester/src/js/examples/Text/TextExample.windows.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1550,7 +1550,9 @@ const examples = [
15501550
<Text
15511551
nativeID="text-accessibility"
15521552
accessibilityLabel="This text has customized accessibility"
1553-
accessibilityHint="Text">
1553+
accessibilityHint="Text"
1554+
accessibilityPosInSet={1}
1555+
accessibilitySetSize={1}>
15541556
This text has customized accessibility.
15551557
</Text>
15561558
</View>

packages/@react-native-windows/tester/src/js/examples/TextInput/TextInputExample.windows.js

+27
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,33 @@ const examples: Array<RNTesterModuleExample> = [
800800
);
801801
},
802802
},
803+
{
804+
title: 'Set of TextInputs',
805+
render: function (): React.Node {
806+
return (
807+
<View accessible testID="textinput-set">
808+
<ExampleTextInput
809+
style={styles.singleLine}
810+
placeholder='TextInput 1 in Set of 3'
811+
accessibilityPosInSet={1}
812+
accessibilitySetSize={3}
813+
/>
814+
<ExampleTextInput
815+
style={styles.singleLine}
816+
placeholder='TextInput 2 in Set of 3'
817+
accessibilityPosInSet={2}
818+
accessibilitySetSize={3}
819+
/>
820+
<ExampleTextInput
821+
style={styles.singleLine}
822+
placeholder='TextInput 3 in Set of 3'
823+
accessibilityPosInSet={3}
824+
accessibilitySetSize={3}
825+
/>
826+
</View>
827+
);
828+
},
829+
},
803830
// Windows]
804831
];
805832

0 commit comments

Comments
 (0)