Skip to content
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

TalkBack support for ScrollView accessibility announcements (list and grid) #33180

Closed
Closed
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
26d37b7
announce showing x of y items in flatlist
intergalacticspacehighway Jun 6, 2021
a40df5d
Merge branch 'master' into flatlist-a11y
intergalacticspacehighway Jun 19, 2021
ec09520
feat: grid accessibility announcement in flatlist
intergalacticspacehighway Jun 20, 2021
55877da
feat: nested flatlist example
intergalacticspacehighway Jun 20, 2021
49aec36
Remove .gitattributes causing error add_cacheinfo
fabOnReact Feb 24, 2022
2977e29
Merge branch 'main' into intergalactic-flatlist-update
fabOnReact Feb 24, 2022
60f7794
remove duplicate method getContentView
fabOnReact Feb 24, 2022
062cdcd
fix Runtime Error NoSuchKey exception columnCount
fabOnReact Feb 24, 2022
78b5fe3
rename accessibilityCollectionInfo to accessibilityCollection
fabOnReact Feb 24, 2022
80acf52
rename collectionItemInfoCompat to collectionItemCompat
fabOnReact Feb 24, 2022
cb2bc3b
Merge branch 'main' into intergalactic-flatlist-lastest-main
fabOnReact Feb 24, 2022
3b9a034
minor change
fabOnReact Feb 24, 2022
a89dd31
Merge branch 'main' into intergalactic-flatlist-lastest-main
fabOnReact Feb 25, 2022
1563620
minor change
fabOnReact Feb 25, 2022
cbd1029
Merge branch 'main' into intergalactic-flatlist-lastest-main
fabOnReact Feb 25, 2022
18f7772
yarn run lint --fix
fabOnReact Feb 26, 2022
2a76611
HorizontalSVManager has already property "accessibilityCollection".
fabOnReact Feb 26, 2022
e36b261
fix flow errors (more info in description)
fabOnReact Feb 26, 2022
32676eb
Fixing type flow errors
fabOnReact Feb 26, 2022
3a9e6d8
jest update FlatList snapshots
fabOnReact Feb 26, 2022
7ca9acd
remove accessibilityCollection from AndroidHorizontalScrollViewNative…
fabOnReact Feb 26, 2022
deb4d6b
format and adding some comments
fabOnReact Feb 26, 2022
42de4dc
fixing flow error for prop accessibilityCollectionItem
fabOnReact Feb 26, 2022
968db38
moving ScrollView accessibility to seperate class
fabOnReact Mar 7, 2022
3fcc666
ReactScrollViewADelegate (more info)
fabOnReact Mar 7, 2022
fc6a755
moving logic to method onInitialize..Internal
fabOnReact Mar 7, 2022
cd392c3
draft solution with refactoring
fabOnReact Mar 11, 2022
b7e5365
Avoid code duplication in AccessibilityDelegate logic
fabOnReact Mar 11, 2022
fc636f9
Merge branch 'main' into intergalactic-flatlist-lastest-main
fabOnReact Mar 11, 2022
3fc34d4
Removing Generic and using check out Type
fabOnReact Mar 11, 2022
389761d
remove log
fabOnReact Mar 11, 2022
fc48b99
Delete file List.java
fabOnReact Mar 11, 2022
b97e5e1
change RNScrollDelegate methods to private
fabOnReact Mar 11, 2022
6062029
log soft exception if RSCADelegate is used in wrong class
fabOnReact Mar 11, 2022
6515fba
remove default value of false to isVisible
fabOnReact Mar 11, 2022
09be9f1
minor change
fabOnReact Mar 11, 2022
70e83a2
moving ReactScrollViewAccessibilityDelegate to /react/views/scroll
fabOnReact Mar 11, 2022
6bc0f5a
adding itemIndex variable as index is used twice
fabOnReact Mar 11, 2022
4c3182a
Removing container View in renderItem
fabOnReact Mar 13, 2022
fb795ad
draft
fabOnReact Mar 13, 2022
1a98f56
removing container View in renderItem callback
fabOnReact Mar 13, 2022
fe5dae5
rename accessibleItem to collectionItem
fabOnReact Mar 13, 2022
f5b3581
removing collectionItem variable
fabOnReact Mar 13, 2022
4e64a52
removing const {index} = info;
fabOnReact Mar 13, 2022
828fdd7
adding new prop to renderItem accessibilityCollectionItem
fabOnReact Mar 13, 2022
ce18d88
avoid adding new lines
fabOnReact Mar 13, 2022
f49caa4
Move Logic to virtualized list
fabOnReact Mar 13, 2022
7514735
move accessibilityCollectionItem logic to VirtList
fabOnReact Mar 14, 2022
fb30b84
Fix failure is caused by the missing prop type accessibilityCollectio…
fabOnReact Mar 14, 2022
4554dcc
fix VirtList flow errors
fabOnReact Mar 14, 2022
31c720f
fix error undefined accessibilityRole in SectionList
fabOnReact Mar 14, 2022
cd2fb42
fix flow errors (deleted )
fabOnReact Mar 14, 2022
f5ee947
Merge branch 'main' into intergalactic-flatlist-lastest-main
fabOnReact Mar 14, 2022
3ead692
passing accessibilityCollectionItem to SectionList renderItem
fabOnReact Mar 14, 2022
a1dfa77
VList adding AccessibilityCollectionItem type
fabOnReact Mar 14, 2022
97c402b
adding grid role to AccessibilityRole type
fabOnReact Mar 14, 2022
6e59c55
update comments on accessibilityCollectionItem
fabOnReact Mar 14, 2022
623d9a9
yarn test Libraries/Lists/__tests__/VirtualizedList-test.js -u
fabOnReact Mar 14, 2022
0b64655
yarn test Libraries/Lists/__tests__/VirtualizedSectionList-test.js -u
fabOnReact Mar 14, 2022
f47df94
update FlatList-test.js snapshot
fabOnReact Mar 14, 2022
7269008
update SectionList snapshot tests
fabOnReact Mar 14, 2022
9ca3d2d
update accessibilityCollectionItem comments
fabOnReact Mar 14, 2022
2b9abe0
correct imports alphabetical order
fabOnReact Mar 15, 2022
489ebe4
use getChildAt instead of getContentView
fabOnReact Mar 15, 2022
3a11bff
add numColumns to restProps passed to VirtualizedList
fabOnReact Mar 15, 2022
d50fd1a
adding prop getCellsInItemCount to VirtualizedList
fabOnReact Mar 15, 2022
40085dc
adding link to comment
fabOnReact Mar 15, 2022
c99fcb8
Merge branch 'main' into intergalactic-flatlist-lastest-main
fabOnReact Mar 15, 2022
1cdaf65
getCellsInItemCount is optional
fabOnReact Mar 15, 2022
c0893d2
add link to comment
fabOnReact Mar 15, 2022
cad423e
updating snapshot based on new behaviour introduced with https://gith…
fabOnReact Mar 16, 2022
7e12fb6
update snapshot based on changes done in https://github.com/fabriziob…
fabOnReact Mar 16, 2022
2cfaf4a
Merge branch 'main' into intergalactic-flatlist-lastest-main
fabOnReact Mar 16, 2022
c3c01bd
Merge branch 'main' into intergalactic-flatlist-lastest-main
fabOnReact Mar 22, 2022
6780e00
remove changes to getContentView
fabOnReact Mar 22, 2022
d647b46
adding /ReactAndroid/hermes-engine/.cxx to .gitignore
fabOnReact Mar 31, 2022
b754395
Merge branch 'main' into intergalactic-flatlist-lastest-main
fabOnReact Mar 31, 2022
53c455d
Merge branch 'main' into intergalactic-flatlist-lastest-main
fabOnReact Apr 4, 2022
d0d69a5
Merge branch 'main' into intergalactic-flatlist-lastest-main
fabOnReact Apr 6, 2022
0284797
Merge branch 'main' into intergalactic-flatlist-lastest-main
fabOnReact Apr 11, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 60 additions & 6 deletions Libraries/Lists/FlatList.js
Original file line number Diff line number Diff line change
Expand Up @@ -614,24 +614,72 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
return (
<View style={StyleSheet.compose(styles.row, columnWrapperStyle)}>
{item.map((it, kk) => {
const element = renderer({
item: it,
index: index * numColumns + kk,
separators: info.separators,
});
const accessibilityCollectionItem = {
rowIndex: index,
rowSpan: 1,
columnIndex: (index * numColumns + kk) % numColumns,
columnSpan: 1,
heading: false,
itemIndex: index * numColumns + kk,
kacieb marked this conversation as resolved.
Show resolved Hide resolved
};

const element = (
// $FlowFixMe[prop-missing] https://bit.ly/3viYSh8
kacieb marked this conversation as resolved.
Show resolved Hide resolved
<View
importantForAccessibility="yes"
style={styles.cellStyle}
kacieb marked this conversation as resolved.
Show resolved Hide resolved
accessibilityCollectionItem={accessibilityCollectionItem}>
{renderer({
item: it,
index: index * numColumns + kk,
separators: info.separators,
})}
</View>
);
return element != null ? (
<React.Fragment key={kk}>{element}</React.Fragment>
) : null;
})}
</View>
);
} else {
return renderer(info);
const {index} = info;

const accessibilityCollectionItem = {
rowIndex: index,
rowSpan: 1,
columnIndex: 0,
columnSpan: 1,
heading: false,
itemIndex: index,
};

return (
// $FlowFixMe[prop-missing] https://bit.ly/3viYSh8
<View
importantForAccessibility="yes"
style={styles.cellStyle}
accessibilityCollectionItem={accessibilityCollectionItem}>
{renderer(info)}
</View>
);
}
},
};
};

_getAccessibilityCollection = () => {
const accessibilityCollectionProps = {
itemCount: this.props.data ? this.props.data.length : 0,
//$FlowFixMe[incompatible-call] see https://bit.ly/3viYSh8
kacieb marked this conversation as resolved.
Show resolved Hide resolved
rowCount: this._getItemCount(this.props.data),
columnCount: numColumnsOrDefault(this.props.numColumns),
hierarchical: false,
};

return accessibilityCollectionProps;
};

render(): React.Node {
const {
numColumns,
Expand All @@ -646,6 +694,11 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
getItem={this._getItem}
getItemCount={this._getItemCount}
keyExtractor={this._keyExtractor}
accessibilityCollection={this._getAccessibilityCollection()}
accessibilityRole={Platform.select({
android:
numColumnsOrDefault(this.props.numColumns) > 1 ? 'grid' : 'list',
})}
ref={this._captureRef}
viewabilityConfigCallbackPairs={this._virtualizedListPairs}
removeClippedSubviews={removeClippedSubviewsOrDefault(
Expand All @@ -659,6 +712,7 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {

const styles = StyleSheet.create({
row: {flexDirection: 'row'},
cellStyle: {flex: 1},
});

module.exports = FlatList;
Loading