Skip to content

Commit 238c860

Browse files
feat: support aria-hidden prop (#1474)
1 parent f0fee35 commit 238c860

File tree

5 files changed

+6
-1
lines changed

5 files changed

+6
-1
lines changed

src/helpers/__tests__/format-default.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const node: ReactTestRendererJSON = {
1010
describe('mapPropsForQueryError', () => {
1111
test('preserves props that are helpful for debugging', () => {
1212
const props = {
13+
'aria-hidden': true,
1314
accessibilityElementsHidden: true,
1415
accessibilityViewIsModal: true,
1516
importantForAccessibility: 'yes',
@@ -25,7 +26,6 @@ describe('mapPropsForQueryError', () => {
2526
};
2627

2728
const result = defaultMapProps(props, node);
28-
2929
expect(result).toStrictEqual(props);
3030
});
3131

src/helpers/accessiblity.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ function isSubtreeInaccessible(element: ReactTestInstance): boolean {
6262
return false;
6363
}
6464

65+
// See: https://reactnative.dev/docs/accessibility#aria-hidden
6566
if (element.props['aria-hidden']) {
6667
return true;
6768
}

src/helpers/format-default.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const propsToDisplay = [
1111
'accessibilityLabel',
1212
'accessibilityLabelledBy',
1313
'accessibilityHint',
14+
'aria-hidden',
1415
'placeholder',
1516
'value',
1617
'defaultValue',

src/queries/__tests__/makeQueries.test.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ describe('printing element tree', () => {
1818
test('prints helpful props but not others', async () => {
1919
const { getByText } = render(
2020
<View
21+
aria-hidden
2122
accessibilityElementsHidden
2223
accessibilityViewIsModal
2324
importantForAccessibility="yes"
@@ -48,6 +49,7 @@ describe('printing element tree', () => {
4849
accessibilityLabelledBy="LABELLED_BY"
4950
accessibilityRole="summary"
5051
accessibilityViewIsModal={true}
52+
aria-hidden={true}
5153
importantForAccessibility="yes"
5254
nativeID="NATIVE_ID"
5355
testID="TEST_ID"

website/docs/API.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,7 @@ This covers only part of [ARIA notion of Accessiblity Tree](https://www.w3.org/T
933933
For the scope of this function, element is inaccessible when it, or any of its ancestors, meets any of the following conditions:
934934

935935
- it has `display: none` style
936+
- it has [`aria-hidden`](https://reactnative.dev/docs/accessibility#aria-hidden) prop set to `true`
936937
- it has [`accessibilityElementsHidden`](https://reactnative.dev/docs/accessibility#accessibilityelementshidden-ios) prop set to `true`
937938
- it has [`importantForAccessibility`](https://reactnative.dev/docs/accessibility#importantforaccessibility-android) prop set to `no-hide-descendants`
938939
- it has sibling host element with [`accessibilityViewIsModal`](https://reactnative.dev/docs/accessibility#accessibilityviewismodal-ios) prop set to `true`

0 commit comments

Comments
 (0)