From 1c79356296c005fa664d82de4568626c926a141f Mon Sep 17 00:00:00 2001
From: YevheniiKotyrlo <44449990+YevheniiKotyrlo@users.noreply.github.com>
Date: Tue, 1 Dec 2026 22:17:52 +0200
Subject: [PATCH] Test aria-hidden on ScrollView and ActivityIndicator
resolveAriaProps maps aria-hidden on ScrollView and ActivityIndicator
since #59379, with no test for it. Fantom cases now cover the mapping to
importantForAccessibility="no-hide-descendants" and its reset when the
prop is removed, and, on ScrollView, an explicit importantForAccessibility
kept when aria-hidden is absent or false. RNTester's aria-hidden example
gains a ScrollView and an ActivityIndicator.
---
.../__tests__/ActivityIndicator-itest.js | 34 ++++++++
.../ScrollView/__tests__/ScrollView-itest.js | 78 +++++++++++++++++++
.../Accessibility/AccessibilityExample.js | 11 +++
3 files changed, 123 insertions(+)
diff --git a/packages/react-native/Libraries/Components/ActivityIndicator/__tests__/ActivityIndicator-itest.js b/packages/react-native/Libraries/Components/ActivityIndicator/__tests__/ActivityIndicator-itest.js
index 7b7897545dc2..edfcc89cbd92 100644
--- a/packages/react-native/Libraries/Components/ActivityIndicator/__tests__/ActivityIndicator-itest.js
+++ b/packages/react-native/Libraries/Components/ActivityIndicator/__tests__/ActivityIndicator-itest.js
@@ -66,4 +66,38 @@ describe('ActivityIndicator', () => {
root.getRenderedOutput({props: ['accessibilityLabel']}).toJSX(),
).toEqual();
});
+
+ it('maps aria-hidden to importantForAccessibility', () => {
+ const root = Fantom.createRoot();
+ Fantom.runTask(() => {
+ root.render();
+ });
+
+ expect(
+ root.getRenderedOutput({props: ['importantForAccessibility']}).toJSX(),
+ ).toEqual(
+ ,
+ );
+ });
+
+ it('resets importantForAccessibility when aria-hidden is removed', () => {
+ const root = Fantom.createRoot();
+ Fantom.runTask(() => {
+ root.render();
+ });
+
+ expect(
+ root.getRenderedOutput({props: ['importantForAccessibility']}).toJSX(),
+ ).toEqual(
+ ,
+ );
+
+ Fantom.runTask(() => {
+ root.render();
+ });
+
+ expect(
+ root.getRenderedOutput({props: ['importantForAccessibility']}).toJSX(),
+ ).toEqual();
+ });
});
diff --git a/packages/react-native/Libraries/Components/ScrollView/__tests__/ScrollView-itest.js b/packages/react-native/Libraries/Components/ScrollView/__tests__/ScrollView-itest.js
index d98e792fa94a..e5eaa068debf 100644
--- a/packages/react-native/Libraries/Components/ScrollView/__tests__/ScrollView-itest.js
+++ b/packages/react-native/Libraries/Components/ScrollView/__tests__/ScrollView-itest.js
@@ -101,6 +101,84 @@ describe('', () => {
,
);
});
+
+ it('maps aria-hidden to importantForAccessibility', () => {
+ const root = Fantom.createRoot();
+
+ Fantom.runTask(() => {
+ root.render();
+ });
+
+ expect(
+ root.getRenderedOutput({props: ['importantForAccessibility']}).toJSX(),
+ ).toEqual(
+
+
+ ,
+ );
+ });
+
+ it('resets importantForAccessibility when aria-hidden is removed', () => {
+ const root = Fantom.createRoot();
+
+ Fantom.runTask(() => {
+ root.render();
+ });
+
+ expect(
+ root.getRenderedOutput({props: ['importantForAccessibility']}).toJSX(),
+ ).toEqual(
+
+
+ ,
+ );
+
+ Fantom.runTask(() => {
+ root.render();
+ });
+
+ expect(
+ root.getRenderedOutput({props: ['importantForAccessibility']}).toJSX(),
+ ).toEqual(
+
+
+ ,
+ );
+ });
+
+ it('keeps an explicit importantForAccessibility when aria-hidden is absent', () => {
+ const root = Fantom.createRoot();
+
+ Fantom.runTask(() => {
+ root.render();
+ });
+
+ expect(
+ root.getRenderedOutput({props: ['importantForAccessibility']}).toJSX(),
+ ).toEqual(
+
+
+ ,
+ );
+ });
+
+ it('keeps an explicit importantForAccessibility when aria-hidden is false', () => {
+ const root = Fantom.createRoot();
+
+ Fantom.runTask(() => {
+ root.render(
+ ,
+ );
+ });
+
+ expect(
+ root.getRenderedOutput({props: ['importantForAccessibility']}).toJSX(),
+ ).toEqual(
+
+
+ ,
+ );
+ });
});
describe('hitSlop', () => {
diff --git a/packages/rn-tester/js/examples/Accessibility/AccessibilityExample.js b/packages/rn-tester/js/examples/Accessibility/AccessibilityExample.js
index 828b1b6260d2..4c09d429f091 100644
--- a/packages/rn-tester/js/examples/Accessibility/AccessibilityExample.js
+++ b/packages/rn-tester/js/examples/Accessibility/AccessibilityExample.js
@@ -22,6 +22,7 @@ import * as React from 'react';
import {createRef, useEffect, useRef, useState} from 'react';
import {
AccessibilityInfo,
+ ActivityIndicator,
Alert,
Button,
Image,
@@ -2269,6 +2270,16 @@ function AriaHiddenExample(): React.Node {
source={require('../../assets/like.png')}
style={styles.button}
/>
+
+
+
+ {ariaHidden
+ ? 'ScrollView content that should be hidden'
+ : 'ScrollView content that should be accessible'}
+
+
+
+
);
}