Skip to content

Commit

Permalink
Add Various Accessibility Properties
Browse files Browse the repository at this point in the history
  • Loading branch information
hmh84 authored and renrizzolo committed Apr 24, 2023
1 parent 59d93e4 commit 3675c70
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
11 changes: 8 additions & 3 deletions lib/components/RowItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ class RowItem extends Component {
subItemsFlatListProps
} = this.props
const hasDropDown = item[subKey] && item[subKey].length > 0 && showDropDowns
const itemSelected = this._itemSelected(item)
const showSubCategoryDropDown = this._showSubCategoryDropDown()

return (
<View>
Expand All @@ -230,6 +232,8 @@ class RowItem extends Component {
<TouchableOpacity
disabled={(readOnlyHeadings && !showDropDowns) || item.disabled}
onPress={this._dropDownOrToggle}
accessibilityState={{ selected: itemSelected }}
accessibilityRole={readOnlyHeadings ? 'header' : 'menuitem'}
style={[
{
flex: 1,
Expand All @@ -239,7 +243,7 @@ class RowItem extends Component {
paddingVertical: 6
},
mergedStyles.item,
this._itemSelected(item) && mergedStyles.selectedItem
itemSelected && mergedStyles.selectedItem
]}
>
{selectedIconOnLeft && this._renderSelectedIcon()}
Expand Down Expand Up @@ -280,9 +284,10 @@ class RowItem extends Component {
},
mergedStyles.toggleIcon
]}
accessibilityState={{ expanded: showSubCategoryDropDown }}
onPress={this._toggleDropDown}
>
{this._showSubCategoryDropDown() ? (
{showSubCategoryDropDown ? (
<View>
{callIfFunction(dropDownToggleIconUpComponent) || (
<Icon
Expand All @@ -308,7 +313,7 @@ class RowItem extends Component {
</TouchableOpacity>
)}
</View>
{item[subKey] && this._showSubCategoryDropDown() && (
{item[subKey] && showSubCategoryDropDown && (
<FlatList
keyExtractor={(i) => `${i[uniqueKey]}`}
data={item[subKey]}
Expand Down
2 changes: 2 additions & 0 deletions lib/components/RowSubItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ class RowSubItem extends Component {
<TouchableOpacity
disabled={highlightChild || subItem.disabled}
onPress={this._toggleItem}
accessibilityState={{ selected: itemSelected }}
accessibilityRole="menuitem"
style={[
{
flex: 1,
Expand Down
3 changes: 2 additions & 1 deletion lib/sectioned-multi-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,8 @@ class SectionedMultiSelect extends PureComponent {
<TouchableWithoutFeedback
onPress={this._toggleSelector}
disabled={this.state.selector || disabled}
>
accessibilityRole="combobox"
>
<View
style={[
{
Expand Down

0 comments on commit 3675c70

Please sign in to comment.