-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android: Position in Collection not supported by Flatlist, SectionList, VirtualizedList, or ScrollView #6
Comments
This comment was marked as resolved.
This comment was marked as resolved.
<FlatList numColumns={undefined} /> Expected Result: Actual Result: CLICK TO OPEN TESTS RESULTS - WITHOUT RUNTIME
numColumnsNoRuntime.mp4CLICK TO OPEN TESTS RESULTS - WITH RUNTIME
numColumnsRuntime.mp4Solved with fabOnReact/react-native@062cdcd |
This comment was marked as off-topic.
This comment was marked as off-topic.
Scenarios Previously Tested in facebook/react-native#31666 (comment) (VIDEO1 and VIDEO2)
New Scenarios
|
This comment was marked as off-topic.
This comment was marked as off-topic.
Columns in FlatList with multiple columns are not announced
Expected Result:
Actual Result:
The TalkBack announcements are correct when using 1 column. CLICK TO OPEN EXAMPLE
data const DATA = [
{
id: 'bd7acbea-c1b1-46c2-aed5-3ad53abb28ba',
title: 'Marketplace',
},
{
id: '3ac68afc-c605-48d3-a4f8-fbd91aa97f63',
title: 'FriendsList',
},
{
id: '58694a0f-3da1-471f-bd96-145571e29d72',
title: 'Groups',
},
{
id: 'bd7acbea-c1b1-46c2-aed5-3ad53abb8bbb',
title: 'Pages',
},
{
id: '3ac68afc-c605-48d3-a4f8-fbd91aa97676',
title: 'Fifth Item',
},
{
id: '58694a0f-3da1-471f-bd96-145571e27234',
title: 'Sixth Item',
},
];
// and more items JSX <>
<FlatList
keyExtractor={item => item.id}
numColumns={2}
pagingEnabled={true}
data={DATA}
renderItem={renderItem}
keyExtractor={item => item.toString()}
/>
</> CLICK TO OPEN TESTS RESULTS - EXPECTED BEHAVIOUR
gridViewExpectedBehaviour.mp4CLICK TO OPEN TESTS RESULTS - ACTUAL BEHAVIOUR
columnsInSpanNotAnnounced.mp4 |
SOLUTION FOR ISSUE #6 (comment)The issue is caused by this 2 lines. Commenting them and replacing them with a random integer number fixes the issue.
CLICK TO OPEN VIDEO - NOT ANNOUNCING COLUMN
notAnnouncingColumn.mp4CLICK TO OPEN VIDEO - ANNOUNCING COLUMN
announcingColumn.mp4CLICK TO OPEN VIDEO - ANNOUNCING COLUMN AND ROW
announcingColumnAndRow.mp4CLICK TO OPEN VIDEO - SCROLL PAGE BEFORE
With 3 columns - Before the Change verifyBehaviourWithoutChange.mp4CLICK TO OPEN VIDEO - SCROLL PAGE AFTER
With 3 columns - After the Change notAnnouncingCorrectListCount.mp4CLICK TO OPEN MORE INFO
Removing the lines below (or replacing grid with list) would remove the row/column announcement. more info at #6 (comment) The index is set correctly for columns 1 and 2, but TalkBack does not announce them. The reason is that our Java Implementation of FlatList numColums does not use GridView, but simply uses ScrollView formatting data as a 2 columns table. Removing the above line:
Adding the accessibilityRole CLICK TO OPEN TESTS RESULTS
removingRole.mp4 |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as off-topic.
This comment was marked as off-topic.
This reverts commit 048c5b9.
Using height instead of widthSolves #6 (comment) #6 (comment). private boolean isPartiallyScrolledInView(View descendent) {
int scrollDelta = getScrollDelta(descendent);
descendent.getDrawingRect(mTempRect);
return scrollDelta != 0 && Math.abs(scrollDelta) < mTempRect.height();
} |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Not announcing correctly the last page (partial scroll)Solves #6 (comment) #6 (comment). 2022-02-16.12-51-16.mp4 |
TalkBack announces pages when scrolling down a GridView TalkBack announces fabOnReact/MyApplication@0bfa67e 2022-02-17.10-52-22.mp4 |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
numColums default was removed with commit fabOnReact/react-native-notes@7d5895d More info at fabOnReact/react-native-notes#6 (comment)
TalkBack announces pages and cells with Horizontal Flatlist in the Paper Renderer Expected/Actual Result:
Expected/Actual Result:
CLICK TO OPEN SOURCECODE
<FlatList
horizontal={true}
data={DATA}
renderItem={renderFlatList}
keyExtractor={item => item.toString()}
/> const Item = ({title}) => (
<View style={styles.item}>
<Text style={styles.title}>{title}</Text>
</View>
);
const renderFlatList = ({item}) => (
<View>
<Item title={item.title} />
</View>
); data used in flatlist
const DATA = [
{
id: '1',
title: '1 Item',
},
{
id: '2',
title: '2 Item',
},
{
id: '3',
title: '3 Item',
},
{
id: '4',
title: '4 Item',
},
{
id: '5',
title: 'Fifth Item',
},
{
id: '6',
title: 'Sixth Item',
},
{
id: '7',
title: 'Seven Item',
},
{
id: '8',
title: 'Eight Item',
},
{
id: '9',
title: 'Nine Item',
},
{
id: '10',
title: 'Ten Item',
},
{
id: '11',
title: 'Eleven Item',
},
{
id: '12',
title: 'Twelve Item',
},
{
id: '13',
title: 'Thirdteen Item',
},
{
id: '14',
title: 'Fourteen Item',
},
{
id: '15',
title: 'Fifthteen Item',
},
{
id: '16',
title: 'Sixteen Item',
},
{
id: '17',
title: '17 Item',
},
{
id: '18',
title: '18 Item',
},
{
id: '19',
title: '19 Item',
},
{
id: '20',
title: '20 Item',
},
{
id: '21',
title: '21 Item',
},
{
id: '22',
title: '22 Item',
},
{
id: '21',
title: '23 Item',
},
{
id: '22',
title: '24 Item',
},
{
id: '22',
title: '25 Item',
},
{
id: '23',
title: '26 Item',
},
{
id: '24',
title: '27 Item',
},
{
id: '25',
title: '28 Item',
},
{
id: '26',
title: '29 Item',
},
]; CLICK TO OPEN VIDEO TESTS
2022-02-25.10-15-30.mp4 |
TalkBack announces pages and cells with Vertical Flatlist in the Paper Renderer Expected/Actual Result:
Expected/Actual Result:
CLICK TO OPEN SOURCECODE
fabOnReact/ReactNativeAwesomeProject@016921e class App extends React.Component {
constructor(props) {
super(props);
}
header = () => {
return (
<View>
<Text>POSTS</Text>
</View>
);
};
render() {
return (
<FlatList
accessible={true}
accessibilityRole="grid"
numColumns={3}
keyExtractor={item => item.id}
pagingEnabled={false}
data={DATA}
renderItem={renderItem}
keyExtractor={item => item.toString()}
/>
);
}
}
const renderItem = ({item, key}) => (
<View key={key} style={styles.item}>
<Text key={key}>{item.title}</Text>
</View>
); const Item = ({title}) => (
<View style={styles.item}>
<Text style={styles.title}>{title}</Text>
</View>
);
const renderFlatList = ({item}) => (
<View>
<Item title={item.title} />
</View>
); data used in flatlist
const DATA = [
{
id: '1',
title: '1 Item',
},
{
id: '2',
title: '2 Item',
},
{
id: '3',
title: '3 Item',
},
{
id: '4',
title: '4 Item',
},
{
id: '5',
title: 'Fifth Item',
},
{
id: '6',
title: 'Sixth Item',
},
{
id: '7',
title: 'Seven Item',
},
{
id: '8',
title: 'Eight Item',
},
{
id: '9',
title: 'Nine Item',
},
{
id: '10',
title: 'Ten Item',
},
{
id: '11',
title: 'Eleven Item',
},
{
id: '12',
title: 'Twelve Item',
},
{
id: '13',
title: 'Thirdteen Item',
},
{
id: '14',
title: 'Fourteen Item',
},
{
id: '15',
title: 'Fifthteen Item',
},
{
id: '16',
title: 'Sixteen Item',
},
{
id: '17',
title: '17 Item',
},
{
id: '18',
title: '18 Item',
},
{
id: '19',
title: '19 Item',
},
{
id: '20',
title: '20 Item',
},
{
id: '21',
title: '21 Item',
},
{
id: '22',
title: '22 Item',
},
{
id: '21',
title: '23 Item',
},
{
id: '22',
title: '24 Item',
},
{
id: '22',
title: '25 Item',
},
{
id: '23',
title: '26 Item',
},
{
id: '24',
title: '27 Item',
},
{
id: '25',
title: '28 Item',
},
{
id: '26',
title: '29 Item',
},
]; CLICK TO OPEN VIDEO TESTS
2022-02-25.10-35-37.mp4 |
This comment was marked as resolved.
This comment was marked as resolved.
TalkBack announces pages and cells with Nested Horizontal Flatlist in the rn-tester app Expected/Actual Result:
Expected/Actual Result:
CLICK TO OPEN VIDEO TESTS
2022-02-25.15-52-46.mp4 |
facebook/react-native#33180 (comment)
I moved this logic to VirtualizedList with commits move accessibilityCollectionItem logic to VirtList, Move Logic to virtualized list and removing container View in renderItem callback removing the View container around the cell. The callback renderItem now has the Example of the implementation with FlatList
I added the prop type accessibilityCollectionItem to the View Component, which is used in this case as a wrapper around each FlatList/SectionList cell. accessibilityCollectionItem in ViewPropTypes
The previous solution was adding a wrapper View Component around each cell. I would like to receive your feedback on this solution before investing further time. Is this the solution you had in mind? I can revert this changes or improve it based on your feedback. Thanks |
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as resolved.
This comment was marked as resolved.
facebook#33180 (comment) >What's the reason for adding this cellStyle here? - we are adding a [View container][1] to each [cell][2] ([renderItem prop][3]) - `{flex: 1}` makes the container View take the full width of the parent container https://reactnative.dev/docs/flexbox#flex >[flex](https://reactnative.dev/docs/layout-props#flex) will define how your items are going to “fill” over the available space along your main axis. Space will be divided according to each element's flex property. | without `{flex: 1}` | with `{flex: 1}` | |:-------------------------:|:-------------------------:| | <img src="https://user-images.githubusercontent.com/24992535/157849508-1958558b-f3b1-4ae1-ab4e-a36c1991ad78.png" width="250" />| <img src="https://user-images.githubusercontent.com/24992535/157849671-7382a7a8-3299-4b88-ab94-7b1c5b8eb9ec.png" width="250" /> | [1]: https://github.com/fabriziobertoglio1987/react-native/blob/70e83a2cbb4f81ea373f3876abd9caf9f35a50a3/Libraries/Lists/FlatList.js#L628-L630 "the View container added to each cell" [2]: https://github.com/fabriziobertoglio1987/react-native/blob/70e83a2cbb4f81ea373f3876abd9caf9f35a50a3/Libraries/Lists/FlatList.js#L581-L601 "the logic responsible to render cells (renderItem prop)" [3]: https://reactnative.dev/docs/next/flatlist#required-renderitem "renderItem prop" original post fabOnReact/react-native-notes#6 (comment)
- remove the wrapper View and cellstyle flex: 1 - add prop accessibilityCollectionItem to FlatList renderItem to allow users set the accessibilityInformation - update rn-tester flatlist examples Follow up of 1a98f56 Related fabOnReact/react-native-notes#6 (comment)
moving _getAccessibilityCollection() to virtualized list
move to |
further info at fabOnReact/react-native-notes#6 (comment) - Adds support for SectionList, VirtualizedList - Sharing common logic between components The accessibilityCollectionItem is calculated in the VirtualizedList and passed as a 4th parameter to renderItem function https://github.com/fabriziobertoglio1987/react-native-notes/blob/f49caa490eb2378466bfa3eeb672aa6eab5b65b7/Libraries/Lists/VirtualizedList.js#L1995-L2023 ```javascript renderItem({ item, index, separators: this._separators, accessibilityCollectionItem, }); ``` adding accessibilityCollectionItem would make the FlatList cell or VirtualizedList row announce row 1 column 1, row 2 column 2 ... https://reactnative.dev/docs/next/flatlist#required-renderitem The main difference between FlatList and VirtualizedList is that FlatList can have numColumns > 1 and the computation of accessibilityCollectionItem is changed in the FlatList based on the numColumns value. TODO - Move logic to ScrollView and add support for ScrollView - Add accessibilityCollectionItem prop to View. The user can change this prop and it is part of the public API
… grid) (#33180) Summary: This issue fixes [30977][17] . The Pull Request was previously published by [intergalacticspacehighway][13] with [31666][19]. The solution consists of: 1. Adding Javascript logic in the [FlatList][14], SectionList, VirtualizedList components to provide accessibility information (row and column position) for each cell in the method [renderItem][20] as a fourth parameter [accessibilityCollectionItem][21]. The information is saved on the native side in the AccessibilityNodeInfo and announced by TalkBack when changing row, column, or page ([video example][12]). The prop accessibilityCollectionItem is available in the View component which wraps each FlatList cell. 2. Adding Java logic in [ReactScrollView.java][16] and HorizontalScrollView to announce pages with TalkBack when scrolling up/down. The missing AOSP logic in [ScrollView.java][10] (see also the [GridView][11] example) is responsible for announcing Page Scrolling with TalkBack. Relevant Links: x [Additional notes on this PR][18] x [discussion on the additional container View around each FlatList cell][22] x [commit adding prop getCellsInItemCount to VirtualizedList][23] ## Changelog [Android] [Added] - Accessibility announcement for list and grid in FlatList Pull Request resolved: #33180 Test Plan: [1]. TalkBack announces pages and cells with Horizontal Flatlist in the Paper Renderer ([link][1]) [2]. TalkBack announces pages and cells with Vertical Flatlist in the Paper Renderer ([link][2]) [3]. `FlatList numColumns={undefined}` Should not trigger Runtime Error NoSuchKey exception columnCount when enabling TalkBack. ([link][3]) [4]. TalkBack announces pages and cells with Nested Horizontal Flatlist in the rn-tester app ([link][4]) [1]: fabOnReact/react-native-notes#6 (comment) [2]: fabOnReact/react-native-notes#6 (comment) [3]: fabOnReact/react-native-notes#6 (comment) [4]: fabOnReact/react-native-notes#6 (comment) [10]:https://github.com/aosp-mirror/platform_frameworks_base/blob/1ac46f932ef88a8f96d652580d8105e361ffc842/core/java/android/widget/AdapterView.java#L1027-L1029 "GridView.java method responsible for calling setFromIndex and setToIndex" [11]:fabOnReact/react-native-notes#6 (comment) "test case on Android GridView" [12]:fabOnReact/react-native-notes#6 (comment) "TalkBack announces pages and cells with Horizontal Flatlist in the Paper Renderer" [13]:https://github.com/intergalacticspacehighway "github intergalacticspacehighway" [14]:https://github.com/fabriziobertoglio1987/react-native/blob/80acf523a4410adac8005d5c9472fb87f78e12ee/Libraries/Lists/FlatList.js#L617-L636 "FlatList accessibilityCollectionItem" [16]:https://github.com/fabriziobertoglio1987/react-native/blob/5706bd7d3ee35dca48f85322a2bdcaec0bce2c85/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java#L183-L184 "logic added to ReactScrollView.java" [17]: #30977 [18]: fabOnReact/react-native-notes#6 [19]: #31666 [20]: https://reactnative.dev/docs/next/flatlist#required-renderitem "FlatList renderItem documentation" [21]: fabOnReact@7514735 "commit that introduces fourth param accessibilityCollectionItem in callback renderItem" [22]: #33180 (comment) "discussion on the additional container View around each FlatList cell" [23]: fabOnReact@d50fd1a "commit adding prop getCellsInItemCount to VirtualizedList" Reviewed By: kacieb Differential Revision: D34518929 Pulled By: blavalla fbshipit-source-id: 410a05263a56162bf505a4cad957b24005ed65ed
… grid) - JAVA ONLY CHANGES (#33180) Summary: This is the Java-only changes from D34518929 (dd6325b), split out for push safety. Original summary and test plan below: This issue fixes [30977][17] . The Pull Request was previously published by [intergalacticspacehighway][13] with [31666][19]. The solution consists of: 1. Adding Javascript logic in the [FlatList][14], SectionList, VirtualizedList components to provide accessibility information (row and column position) for each cell in the method [renderItem][20] as a fourth parameter [accessibilityCollectionItem][21]. The information is saved on the native side in the AccessibilityNodeInfo and announced by TalkBack when changing row, column, or page ([video example][12]). The prop accessibilityCollectionItem is available in the View component which wraps each FlatList cell. 2. Adding Java logic in [ReactScrollView.java][16] and HorizontalScrollView to announce pages with TalkBack when scrolling up/down. The missing AOSP logic in [ScrollView.java][10] (see also the [GridView][11] example) is responsible for announcing Page Scrolling with TalkBack. Relevant Links: x [Additional notes on this PR][18] x [discussion on the additional container View around each FlatList cell][22] x [commit adding prop getCellsInItemCount to VirtualizedList][23] ## Changelog [Android] [Added] - Accessibility announcement for list and grid in FlatList Pull Request resolved: #33180 Test Plan: [1]. TalkBack announces pages and cells with Horizontal Flatlist in the Paper Renderer ([link][1]) [2]. TalkBack announces pages and cells with Vertical Flatlist in the Paper Renderer ([link][2]) [3]. `FlatList numColumns={undefined}` Should not trigger Runtime Error NoSuchKey exception columnCount when enabling TalkBack. ([link][3]) [4]. TalkBack announces pages and cells with Nested Horizontal Flatlist in the rn-tester app ([link][4]) [1]: fabOnReact/react-native-notes#6 (comment) [2]: fabOnReact/react-native-notes#6 (comment) [3]: fabOnReact/react-native-notes#6 (comment) [4]: fabOnReact/react-native-notes#6 (comment) [10]:https://github.com/aosp-mirror/platform_frameworks_base/blob/1ac46f932ef88a8f96d652580d8105e361ffc842/core/java/android/widget/AdapterView.java#L1027-L1029 "GridView.java method responsible for calling setFromIndex and setToIndex" [11]:fabOnReact/react-native-notes#6 (comment) "test case on Android GridView" [12]:fabOnReact/react-native-notes#6 (comment) "TalkBack announces pages and cells with Horizontal Flatlist in the Paper Renderer" [13]:https://github.com/intergalacticspacehighway "github intergalacticspacehighway" [14]:https://github.com/fabriziobertoglio1987/react-native/blob/80acf523a4410adac8005d5c9472fb87f78e12ee/Libraries/Lists/FlatList.js#L617-L636 "FlatList accessibilityCollectionItem" [16]:https://github.com/fabriziobertoglio1987/react-native/blob/5706bd7d3ee35dca48f85322a2bdcaec0bce2c85/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java#L183-L184 "logic added to ReactScrollView.java" [17]: #30977 [18]: fabOnReact/react-native-notes#6 [19]: #31666 [20]: https://reactnative.dev/docs/next/flatlist#required-renderitem "FlatList renderItem documentation" [21]: fabOnReact@7514735 "commit that introduces fourth param accessibilityCollectionItem in callback renderItem" [22]: #33180 (comment) "discussion on the additional container View around each FlatList cell" [23]: fabOnReact@d50fd1a "commit adding prop getCellsInItemCount to VirtualizedList" Reviewed By: kacieb Differential Revision: D37186697 Pulled By: blavalla fbshipit-source-id: 7bb95274326ded417c6f1365cc8633391f589d1a
… grid) - Javascript Only Changes (#33180) Summary: This is the Javascript-only changes from D34518929 (dd6325b), split out for push safety. Original summary and test plan below: This issue fixes [30977][17] . The Pull Request was previously published by [intergalacticspacehighway][13] with [31666][19]. The solution consists of: 1. Adding Javascript logic in the [FlatList][14], SectionList, VirtualizedList components to provide accessibility information (row and column position) for each cell in the method [renderItem][20] as a fourth parameter [accessibilityCollectionItem][21]. The information is saved on the native side in the AccessibilityNodeInfo and announced by TalkBack when changing row, column, or page ([video example][12]). The prop accessibilityCollectionItem is available in the View component which wraps each FlatList cell. 2. Adding Java logic in [ReactScrollView.java][16] and HorizontalScrollView to announce pages with TalkBack when scrolling up/down. The missing AOSP logic in [ScrollView.java][10] (see also the [GridView][11] example) is responsible for announcing Page Scrolling with TalkBack. Relevant Links: x [Additional notes on this PR][18] x [discussion on the additional container View around each FlatList cell][22] x [commit adding prop getCellsInItemCount to VirtualizedList][23] ## Changelog [Android] [Added] - Accessibility announcement for list and grid in FlatList Pull Request resolved: #33180 Test Plan: [1]. TalkBack announces pages and cells with Horizontal Flatlist in the Paper Renderer ([link][1]) [2]. TalkBack announces pages and cells with Vertical Flatlist in the Paper Renderer ([link][2]) [3]. `FlatList numColumns={undefined}` Should not trigger Runtime Error NoSuchKey exception columnCount when enabling TalkBack. ([link][3]) [4]. TalkBack announces pages and cells with Nested Horizontal Flatlist in the rn-tester app ([link][4]) [1]: fabOnReact/react-native-notes#6 (comment) [2]: fabOnReact/react-native-notes#6 (comment) [3]: fabOnReact/react-native-notes#6 (comment) [4]: fabOnReact/react-native-notes#6 (comment) [10]:https://github.com/aosp-mirror/platform_frameworks_base/blob/1ac46f932ef88a8f96d652580d8105e361ffc842/core/java/android/widget/AdapterView.java#L1027-L1029 "GridView.java method responsible for calling setFromIndex and setToIndex" [11]:fabOnReact/react-native-notes#6 (comment) "test case on Android GridView" [12]:fabOnReact/react-native-notes#6 (comment) "TalkBack announces pages and cells with Horizontal Flatlist in the Paper Renderer" [13]:https://github.com/intergalacticspacehighway "github intergalacticspacehighway" [14]:https://github.com/fabriziobertoglio1987/react-native/blob/80acf523a4410adac8005d5c9472fb87f78e12ee/Libraries/Lists/FlatList.js#L617-L636 "FlatList accessibilityCollectionItem" [16]:https://github.com/fabriziobertoglio1987/react-native/blob/5706bd7d3ee35dca48f85322a2bdcaec0bce2c85/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java#L183-L184 "logic added to ReactScrollView.java" [17]: #30977 [18]: fabOnReact/react-native-notes#6 [19]: #31666 [20]: https://reactnative.dev/docs/next/flatlist#required-renderitem "FlatList renderItem documentation" [21]: fabOnReact@7514735 "commit that introduces fourth param accessibilityCollectionItem in callback renderItem" [22]: #33180 (comment) "discussion on the additional container View around each FlatList cell" [23]: fabOnReact@d50fd1a "commit adding prop getCellsInItemCount to VirtualizedList" Reviewed By: kacieb Differential Revision: D37189197 Pulled By: blavalla fbshipit-source-id: 3765213c5d8bfde56e0e5f155cdd899c368512e7
… grid) - Javascript Only Changes (#33180) Summary: This is the Javascript-only changes from D34518929 (dd6325b), split out for push safety. Original summary and test plan below: This issue fixes [30977][17] . The Pull Request was previously published by [intergalacticspacehighway][13] with [31666][19]. The solution consists of: 1. Adding Javascript logic in the [FlatList][14], SectionList, VirtualizedList components to provide accessibility information (row and column position) for each cell in the method [renderItem][20] as a fourth parameter [accessibilityCollectionItem][21]. The information is saved on the native side in the AccessibilityNodeInfo and announced by TalkBack when changing row, column, or page ([video example][12]). The prop accessibilityCollectionItem is available in the View component which wraps each FlatList cell. 2. Adding Java logic in [ReactScrollView.java][16] and HorizontalScrollView to announce pages with TalkBack when scrolling up/down. The missing AOSP logic in [ScrollView.java][10] (see also the [GridView][11] example) is responsible for announcing Page Scrolling with TalkBack. Relevant Links: x [Additional notes on this PR][18] x [discussion on the additional container View around each FlatList cell][22] x [commit adding prop getCellsInItemCount to VirtualizedList][23] ## Changelog [Android] [Added] - Accessibility announcement for list and grid in FlatList Pull Request resolved: #33180 Test Plan: [1]. TalkBack announces pages and cells with Horizontal Flatlist in the Paper Renderer ([link][1]) [2]. TalkBack announces pages and cells with Vertical Flatlist in the Paper Renderer ([link][2]) [3]. `FlatList numColumns={undefined}` Should not trigger Runtime Error NoSuchKey exception columnCount when enabling TalkBack. ([link][3]) [4]. TalkBack announces pages and cells with Nested Horizontal Flatlist in the rn-tester app ([link][4]) [1]: fabOnReact/react-native-notes#6 (comment) [2]: fabOnReact/react-native-notes#6 (comment) [3]: fabOnReact/react-native-notes#6 (comment) [4]: fabOnReact/react-native-notes#6 (comment) [10]:https://github.com/aosp-mirror/platform_frameworks_base/blob/1ac46f932ef88a8f96d652580d8105e361ffc842/core/java/android/widget/AdapterView.java#L1027-L1029 "GridView.java method responsible for calling setFromIndex and setToIndex" [11]:fabOnReact/react-native-notes#6 (comment) "test case on Android GridView" [12]:fabOnReact/react-native-notes#6 (comment) "TalkBack announces pages and cells with Horizontal Flatlist in the Paper Renderer" [13]:https://github.com/intergalacticspacehighway "github intergalacticspacehighway" [14]:https://github.com/fabriziobertoglio1987/react-native/blob/80acf523a4410adac8005d5c9472fb87f78e12ee/Libraries/Lists/FlatList.js#L617-L636 "FlatList accessibilityCollectionItem" [16]:https://github.com/fabriziobertoglio1987/react-native/blob/5706bd7d3ee35dca48f85322a2bdcaec0bce2c85/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java#L183-L184 "logic added to ReactScrollView.java" [17]: #30977 [18]: fabOnReact/react-native-notes#6 [19]: #31666 [20]: https://reactnative.dev/docs/next/flatlist#required-renderitem "FlatList renderItem documentation" [21]: fabOnReact@7514735 "commit that introduces fourth param accessibilityCollectionItem in callback renderItem" [22]: #33180 (comment) "discussion on the additional container View around each FlatList cell" [23]: fabOnReact@d50fd1a "commit adding prop getCellsInItemCount to VirtualizedList" Reviewed By: lunaleaps Differential Revision: D37668064 Pulled By: blavalla fbshipit-source-id: 7ba4068405fdcb9823d0daed2d8c36f0a56dbf0f
… grid) - Javascript Only Changes (facebook#33180) Summary: This is the Javascript-only changes from D34518929 (facebook@dd6325b), split out for push safety. Original summary and test plan below: This issue fixes [30977][17] . The Pull Request was previously published by [intergalacticspacehighway][13] with [31666][19]. The solution consists of: 1. Adding Javascript logic in the [FlatList][14], SectionList, VirtualizedList components to provide accessibility information (row and column position) for each cell in the method [renderItem][20] as a fourth parameter [accessibilityCollectionItem][21]. The information is saved on the native side in the AccessibilityNodeInfo and announced by TalkBack when changing row, column, or page ([video example][12]). The prop accessibilityCollectionItem is available in the View component which wraps each FlatList cell. 2. Adding Java logic in [ReactScrollView.java][16] and HorizontalScrollView to announce pages with TalkBack when scrolling up/down. The missing AOSP logic in [ScrollView.java][10] (see also the [GridView][11] example) is responsible for announcing Page Scrolling with TalkBack. Relevant Links: x [Additional notes on this PR][18] x [discussion on the additional container View around each FlatList cell][22] x [commit adding prop getCellsInItemCount to VirtualizedList][23] ## Changelog [Android] [Added] - Accessibility announcement for list and grid in FlatList Pull Request resolved: facebook#33180 Test Plan: [1]. TalkBack announces pages and cells with Horizontal Flatlist in the Paper Renderer ([link][1]) [2]. TalkBack announces pages and cells with Vertical Flatlist in the Paper Renderer ([link][2]) [3]. `FlatList numColumns={undefined}` Should not trigger Runtime Error NoSuchKey exception columnCount when enabling TalkBack. ([link][3]) [4]. TalkBack announces pages and cells with Nested Horizontal Flatlist in the rn-tester app ([link][4]) [1]: fabOnReact/react-native-notes#6 (comment) [2]: fabOnReact/react-native-notes#6 (comment) [3]: fabOnReact/react-native-notes#6 (comment) [4]: fabOnReact/react-native-notes#6 (comment) [10]:https://github.com/aosp-mirror/platform_frameworks_base/blob/1ac46f932ef88a8f96d652580d8105e361ffc842/core/java/android/widget/AdapterView.java#L1027-L1029 "GridView.java method responsible for calling setFromIndex and setToIndex" [11]:fabOnReact/react-native-notes#6 (comment) "test case on Android GridView" [12]:fabOnReact/react-native-notes#6 (comment) "TalkBack announces pages and cells with Horizontal Flatlist in the Paper Renderer" [13]:https://github.com/intergalacticspacehighway "github intergalacticspacehighway" [14]:https://github.com/fabriziobertoglio1987/react-native/blob/80acf523a4410adac8005d5c9472fb87f78e12ee/Libraries/Lists/FlatList.js#L617-L636 "FlatList accessibilityCollectionItem" [16]:https://github.com/fabriziobertoglio1987/react-native/blob/5706bd7d3ee35dca48f85322a2bdcaec0bce2c85/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java#L183-L184 "logic added to ReactScrollView.java" [17]: facebook#30977 [18]: fabOnReact/react-native-notes#6 [19]: facebook#31666 [20]: https://reactnative.dev/docs/next/flatlist#required-renderitem "FlatList renderItem documentation" [21]: fabOnReact@7514735 "commit that introduces fourth param accessibilityCollectionItem in callback renderItem" [22]: facebook#33180 (comment) "discussion on the additional container View around each FlatList cell" [23]: fabOnReact@d50fd1a "commit adding prop getCellsInItemCount to VirtualizedList" Reviewed By: lunaleaps Differential Revision: D37668064 Pulled By: blavalla fbshipit-source-id: 7ba4068405fdcb9823d0daed2d8c36f0a56dbf0f
… grid) - Javascript Only Changes (facebook#33180) Summary: This is the Javascript-only changes from D34518929 (facebook@dd6325b), split out for push safety. Original summary and test plan below: This issue fixes [30977][17] . The Pull Request was previously published by [intergalacticspacehighway][13] with [31666][19]. The solution consists of: 1. Adding Javascript logic in the [FlatList][14], SectionList, VirtualizedList components to provide accessibility information (row and column position) for each cell in the method [renderItem][20] as a fourth parameter [accessibilityCollectionItem][21]. The information is saved on the native side in the AccessibilityNodeInfo and announced by TalkBack when changing row, column, or page ([video example][12]). The prop accessibilityCollectionItem is available in the View component which wraps each FlatList cell. 2. Adding Java logic in [ReactScrollView.java][16] and HorizontalScrollView to announce pages with TalkBack when scrolling up/down. The missing AOSP logic in [ScrollView.java][10] (see also the [GridView][11] example) is responsible for announcing Page Scrolling with TalkBack. Relevant Links: x [Additional notes on this PR][18] x [discussion on the additional container View around each FlatList cell][22] x [commit adding prop getCellsInItemCount to VirtualizedList][23] ## Changelog [Android] [Added] - Accessibility announcement for list and grid in FlatList Pull Request resolved: facebook#33180 Test Plan: [1]. TalkBack announces pages and cells with Horizontal Flatlist in the Paper Renderer ([link][1]) [2]. TalkBack announces pages and cells with Vertical Flatlist in the Paper Renderer ([link][2]) [3]. `FlatList numColumns={undefined}` Should not trigger Runtime Error NoSuchKey exception columnCount when enabling TalkBack. ([link][3]) [4]. TalkBack announces pages and cells with Nested Horizontal Flatlist in the rn-tester app ([link][4]) [1]: fabOnReact/react-native-notes#6 (comment) [2]: fabOnReact/react-native-notes#6 (comment) [3]: fabOnReact/react-native-notes#6 (comment) [4]: fabOnReact/react-native-notes#6 (comment) [10]:https://github.com/aosp-mirror/platform_frameworks_base/blob/1ac46f932ef88a8f96d652580d8105e361ffc842/core/java/android/widget/AdapterView.java#L1027-L1029 "GridView.java method responsible for calling setFromIndex and setToIndex" [11]:fabOnReact/react-native-notes#6 (comment) "test case on Android GridView" [12]:fabOnReact/react-native-notes#6 (comment) "TalkBack announces pages and cells with Horizontal Flatlist in the Paper Renderer" [13]:https://github.com/intergalacticspacehighway "github intergalacticspacehighway" [14]:https://github.com/fabriziobertoglio1987/react-native/blob/80acf523a4410adac8005d5c9472fb87f78e12ee/Libraries/Lists/FlatList.js#L617-L636 "FlatList accessibilityCollectionItem" [16]:https://github.com/fabriziobertoglio1987/react-native/blob/5706bd7d3ee35dca48f85322a2bdcaec0bce2c85/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java#L183-L184 "logic added to ReactScrollView.java" [17]: facebook#30977 [18]: fabOnReact/react-native-notes#6 [19]: facebook#31666 [20]: https://reactnative.dev/docs/next/flatlist#required-renderitem "FlatList renderItem documentation" [21]: fabOnReact@7514735 "commit that introduces fourth param accessibilityCollectionItem in callback renderItem" [22]: facebook#33180 (comment) "discussion on the additional container View around each FlatList cell" [23]: fabOnReact@d50fd1a "commit adding prop getCellsInItemCount to VirtualizedList" Reviewed By: lunaleaps Differential Revision: D37668064 Pulled By: blavalla fbshipit-source-id: 7ba4068405fdcb9823d0daed2d8c36f0a56dbf0f
… grid) (facebook#33180) Summary: This issue fixes [30977][17] . The Pull Request was previously published by [intergalacticspacehighway][13] with [31666][19]. The solution consists of: 1. Adding Javascript logic in the [FlatList][14], SectionList, VirtualizedList components to provide accessibility information (row and column position) for each cell in the method [renderItem][20] as a fourth parameter [accessibilityCollectionItem][21]. The information is saved on the native side in the AccessibilityNodeInfo and announced by TalkBack when changing row, column, or page ([video example][12]). The prop accessibilityCollectionItem is available in the View component which wraps each FlatList cell. 2. Adding Java logic in [ReactScrollView.java][16] and HorizontalScrollView to announce pages with TalkBack when scrolling up/down. The missing AOSP logic in [ScrollView.java][10] (see also the [GridView][11] example) is responsible for announcing Page Scrolling with TalkBack. Relevant Links: x [Additional notes on this PR][18] x [discussion on the additional container View around each FlatList cell][22] x [commit adding prop getCellsInItemCount to VirtualizedList][23] [Android] [Added] - Accessibility announcement for list and grid in FlatList Pull Request resolved: facebook#33180 Test Plan: [1]. TalkBack announces pages and cells with Horizontal Flatlist in the Paper Renderer ([link][1]) [2]. TalkBack announces pages and cells with Vertical Flatlist in the Paper Renderer ([link][2]) [3]. `FlatList numColumns={undefined}` Should not trigger Runtime Error NoSuchKey exception columnCount when enabling TalkBack. ([link][3]) [4]. TalkBack announces pages and cells with Nested Horizontal Flatlist in the rn-tester app ([link][4]) [1]: fabOnReact/react-native-notes#6 (comment) [2]: fabOnReact/react-native-notes#6 (comment) [3]: fabOnReact/react-native-notes#6 (comment) [4]: fabOnReact/react-native-notes#6 (comment) [10]:https://github.com/aosp-mirror/platform_frameworks_base/blob/1ac46f932ef88a8f96d652580d8105e361ffc842/core/java/android/widget/AdapterView.java#L1027-L1029 "GridView.java method responsible for calling setFromIndex and setToIndex" [11]:fabOnReact/react-native-notes#6 (comment) "test case on Android GridView" [12]:fabOnReact/react-native-notes#6 (comment) "TalkBack announces pages and cells with Horizontal Flatlist in the Paper Renderer" [13]:https://github.com/intergalacticspacehighway "github intergalacticspacehighway" [14]:https://github.com/fabriziobertoglio1987/react-native/blob/80acf523a4410adac8005d5c9472fb87f78e12ee/Libraries/Lists/FlatList.js#L617-L636 "FlatList accessibilityCollectionItem" [16]:https://github.com/fabriziobertoglio1987/react-native/blob/5706bd7d3ee35dca48f85322a2bdcaec0bce2c85/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java#L183-L184 "logic added to ReactScrollView.java" [17]: facebook#30977 [18]: fabOnReact/react-native-notes#6 [19]: facebook#31666 [20]: https://reactnative.dev/docs/next/flatlist#required-renderitem "FlatList renderItem documentation" [21]: fabOnReact@7514735 "commit that introduces fourth param accessibilityCollectionItem in callback renderItem" [22]: facebook#33180 (comment) "discussion on the additional container View around each FlatList cell" [23]: fabOnReact@d50fd1a "commit adding prop getCellsInItemCount to VirtualizedList" Reviewed By: kacieb Differential Revision: D34518929 Pulled By: blavalla fbshipit-source-id: 410a05263a56162bf505a4cad957b24005ed65ed
Issue facebook/react-native#30977
Pull Request facebook/react-native#33180
Related facebook/react-native#31666
The text was updated successfully, but these errors were encountered: