Skip to content

Commit b1e5491

Browse files
authored
Merge pull request #290 from hmh84/add_accessibility_properties
Add Various Accessibility Properties
2 parents a3260c6 + 3675c70 commit b1e5491

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

lib/components/RowItem.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ class RowItem extends Component {
216216
subItemsFlatListProps
217217
} = this.props
218218
const hasDropDown = item[subKey] && item[subKey].length > 0 && showDropDowns
219+
const itemSelected = this._itemSelected(item)
220+
const showSubCategoryDropDown = this._showSubCategoryDropDown()
219221

220222
return (
221223
<View>
@@ -230,6 +232,8 @@ class RowItem extends Component {
230232
<TouchableOpacity
231233
disabled={(readOnlyHeadings && !showDropDowns) || item.disabled}
232234
onPress={this._dropDownOrToggle}
235+
accessibilityState={{ selected: itemSelected }}
236+
accessibilityRole={readOnlyHeadings ? 'header' : 'menuitem'}
233237
style={[
234238
{
235239
flex: 1,
@@ -239,7 +243,7 @@ class RowItem extends Component {
239243
paddingVertical: 6
240244
},
241245
mergedStyles.item,
242-
this._itemSelected(item) && mergedStyles.selectedItem
246+
itemSelected && mergedStyles.selectedItem
243247
]}
244248
>
245249
{selectedIconOnLeft && this._renderSelectedIcon()}
@@ -280,9 +284,10 @@ class RowItem extends Component {
280284
},
281285
mergedStyles.toggleIcon
282286
]}
287+
accessibilityState={{ expanded: showSubCategoryDropDown }}
283288
onPress={this._toggleDropDown}
284289
>
285-
{this._showSubCategoryDropDown() ? (
290+
{showSubCategoryDropDown ? (
286291
<View>
287292
{callIfFunction(dropDownToggleIconUpComponent) || (
288293
<Icon
@@ -308,7 +313,7 @@ class RowItem extends Component {
308313
</TouchableOpacity>
309314
)}
310315
</View>
311-
{item[subKey] && this._showSubCategoryDropDown() && (
316+
{item[subKey] && showSubCategoryDropDown && (
312317
<FlatList
313318
keyExtractor={(i) => `${i[uniqueKey]}`}
314319
data={item[subKey]}

lib/components/RowSubItem.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ class RowSubItem extends Component {
131131
<TouchableOpacity
132132
disabled={highlightChild || subItem.disabled}
133133
onPress={this._toggleItem}
134+
accessibilityState={{ selected: itemSelected }}
135+
accessibilityRole="menuitem"
134136
style={[
135137
{
136138
flex: 1,

lib/sectioned-multi-select.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1292,7 +1292,8 @@ class SectionedMultiSelect extends PureComponent {
12921292
<TouchableWithoutFeedback
12931293
onPress={this._toggleSelector}
12941294
disabled={this.state.selector || disabled}
1295-
>
1295+
accessibilityRole="combobox"
1296+
>
12961297
<View
12971298
style={[
12981299
{

0 commit comments

Comments
 (0)