Skip to content

Commit

Permalink
Make country code button a combobox
Browse files Browse the repository at this point in the history
This is a fix for #2
The country code button should still have role="combobox".
This role communicates that the component will open a listbox.
This is the case of a Select-Only Combobox
https://www.w3.org/WAI/ARIA/apg/example-index/combobox/combobox-select-only.html
  • Loading branch information
VladyslavBondarenko committed Nov 11, 2022
1 parent 37e921d commit 03ed541
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dist/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion example/example.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion example/main.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/components/CountryList.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ class CountryList extends Component {
className={ className }
id={ this.props.countryListId }
role="listbox"
tabIndex="-1"
>
{ preferredOptions }
{ divider }
Expand Down
4 changes: 2 additions & 2 deletions src/components/FlagDropDown.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ class FlagDropDown extends Component {
onClick={ this.props.clickSelectedFlag }
onKeyDown={ this.props.handleSelectedFlagKeydown }
title={ this.props.titleTip }
role="combobox"
aria-controls={ countryListId }
aria-owns={ countryListId }
aria-autocomplete="none"
aria-activedescendant={ this.getItemId(this.props.highlightedCountry) }
aria-expanded={ this.props.showDropdown }
aria-haspopup="listbox"
>
<div className={ flagClass } />
{ genSelectedDialCode() }
Expand Down

0 comments on commit 03ed541

Please sign in to comment.