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

feat: improve screen reader accessibility #405

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

VladyslavBondarenko
Copy link

@VladyslavBondarenko VladyslavBondarenko commented Oct 14, 2022

Description

This allows to follow WAI-ARIA best practices for combobox elements.

Changes:

  • Add role="combobox" to the selected country button
  • Add role="listbox" to the countries list
  • Refer to the countries list by its Id in the combobox element via aria-controls and aria-owns
  • Add role="option" to each country list option
  • Use aria-expanded on the combobox element
  • Refer focused option by its id in the combobox element via aria-activedescendant to read the focused option while navigating by keyboard
  • Add aria-selected="true" to the selected list option
  • Set aria-autocomplete="none" to the combobox element since displayed options do not depend on the number input value
  • Allow passing arbitrary props to the combobox element via flagDropdownProps prop (for example, aria-labelledby property can be passed so that a screen reader can read proper visible label for this input)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have used ESLint & Prettier to follow the code style of this project.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

This allows to follow WAI-ARIA best practices for combobox elements
https://www.w3.org/WAI/ARIA/apg/patterns/combobox/

Changes:
- Add role="combobox" to the selected country button
- Add role="listbox" to the countries list
- Refer the countries list by its Id in the combobox element
  via aria-controls and aria-owns
- Add role="option" to each country list option
- Use aria-expanded on the combobox element
- Refer focused option by its Id in the combobox element
  via aria-activedescendant to read focused option
  while navigating by keyboard
- Add aria-selected="true" to the selected list option
- Set aria-autocomplete="none" to the combobox element
  since displayed options do not depend on the number input value
- Allow passing arbitrary props to the combobox element
  via flagDropdownProps prop
  (for example, "aria-labelledby" property can be passed)
VladyslavBondarenko added a commit to salemove/react-intl-tel-input that referenced this pull request Nov 7, 2022
Ramp task: https://ramp.accessibleweb.com/app/websites/83ca83c6265c/tasks/2787246f7ae2
This allows following WAI-ARIA best practices  for combobox elements -
https://www.w3.org/WAI/ARIA/apg/patterns/combobox/.
Changes in this PR mostly correspond to the patw0929#405

Although most of the best practices to improve accessibility were
implemented, the role="combobox" was not added neither the to
the number input (because the input doesn't show/hide the dropdown),
nor to the country code button.
Looks like OSx VoiceOver announces everything correctly.

Changes:
- Add role="listbox" to the countries list
- Refer the countries list by its Id in the country code button
  via aria-controls and aria-owns
- Add role="option" to each country list option
- Use aria-expanded on the country code button element
- Refer focused option by its Id in the country code button element
  via aria-activedescendant to read focused option while navigating
  by keyboard
- Add aria-selected="true" to the selected list option
- Set aria-autocomplete="none" to the country code button element
  since displayed options do not depend on the number input value
- Allow passing arbitrary props to the country code button element via
  flagDropdownProps prop (for example, "aria-labelledby" property
  can be passed)
VladyslavBondarenko added a commit to salemove/react-intl-tel-input that referenced this pull request Nov 7, 2022
Ramp task: https://ramp.accessibleweb.com/app/websites/83ca83c6265c/tasks/2787246f7ae2
This allows following WAI-ARIA best practices  for combobox elements -
https://www.w3.org/WAI/ARIA/apg/patterns/combobox/.
Changes in this PR mostly correspond to the patw0929#405

Although most of the best practices to improve accessibility were
implemented, the role="combobox" was not added neither the to
the number input (because the input doesn't show/hide the dropdown),
nor to the country code button.
Looks like OSx VoiceOver announces everything correctly.

Changes:
- Add role="listbox" to the countries list
- Refer the countries list by its Id in the country code button
  via aria-controls and aria-owns
- Add role="option" to each country list option
- Use aria-expanded on the country code button element
- Refer focused option by its Id in the country code button element
  via aria-activedescendant to read focused option while navigating
  by keyboard
- Add aria-selected="true" to the selected list option
- Set aria-autocomplete="none" to the country code button element
  since displayed options do not depend on the number input value
- Allow passing arbitrary props to the country code button element via
  flagDropdownProps prop (for example, "aria-labelledby" property
  can be passed)
VladyslavBondarenko added a commit to salemove/react-intl-tel-input that referenced this pull request Nov 7, 2022
Ramp task: https://ramp.accessibleweb.com/app/websites/83ca83c6265c/tasks/2787246f7ae2
This allows following WAI-ARIA best practices  for combobox elements -
https://www.w3.org/WAI/ARIA/apg/patterns/combobox/.
Changes in this PR mostly correspond to the patw0929#405

Although most of the best practices to improve accessibility were
implemented, the role="combobox" was not added neither the to
the number input (because the input doesn't show/hide the dropdown),
nor to the country code button.
Looks like OSx VoiceOver announces everything correctly.

Changes:
- Add role="listbox" to the countries list
- Refer the countries list by its Id in the country code button
  via aria-controls and aria-owns
- Add role="option" to each country list option
- Use aria-expanded on the country code button element
- Refer focused option by its Id in the country code button element
  via aria-activedescendant to read focused option while navigating
  by keyboard
- Add aria-selected="true" to the selected list option
- Set aria-autocomplete="none" to the country code button element
  since displayed options do not depend on the number input value
- Allow passing arbitrary props to the country code button element via
  flagDropdownProps prop (for example, "aria-labelledby" property
  can be passed)

Updates dist files (built with node 7)
VladyslavBondarenko added a commit to salemove/react-intl-tel-input that referenced this pull request Nov 7, 2022
Ramp task: https://ramp.accessibleweb.com/app/websites/83ca83c6265c/tasks/2787246f7ae2
This allows following WAI-ARIA best practices  for combobox elements -
https://www.w3.org/WAI/ARIA/apg/patterns/combobox/.
Changes in this PR mostly correspond to the patw0929#405

Although most of the best practices to improve accessibility were
implemented, the role="combobox" was not added neither the to
the number input (because the input doesn't show/hide the dropdown),
nor to the country code button.
Looks like OSx VoiceOver announces everything correctly.

Changes:
- Add role="listbox" to the countries list
- Refer the countries list by its Id in the country code button
  via aria-controls and aria-owns
- Add role="option" to each country list option
- Use aria-expanded on the country code button element
- Refer focused option by its Id in the country code button element
  via aria-activedescendant to read focused option while navigating
  by keyboard
- Add aria-selected="true" to the selected list option
- Set aria-autocomplete="none" to the country code button element
  since displayed options do not depend on the number input value
- Allow passing arbitrary props to the country code button element via
  flagDropdownProps prop (for example, "aria-labelledby" property
  can be passed)

Updates dist files
VladyslavBondarenko added a commit to salemove/react-intl-tel-input that referenced this pull request Nov 8, 2022
Ramp task: https://ramp.accessibleweb.com/app/websites/83ca83c6265c/tasks/2787246f7ae2
This allows following WAI-ARIA best practices  for combobox elements -
https://www.w3.org/WAI/ARIA/apg/patterns/combobox/.
Changes in this PR mostly correspond to the patw0929#405

Although most of the best practices to improve accessibility were
implemented, the role="combobox" was not added neither the to
the number input (because the input doesn't show/hide the dropdown),
nor to the country code button.
Looks like OSx VoiceOver announces everything correctly.

Changes:
- Add role="listbox" to the countries list
- Refer the countries list by its Id in the country code button
  via aria-controls and aria-owns
- Add role="option" to each country list option
- Use aria-expanded on the country code button element
- Refer focused option by its Id in the country code button element
  via aria-activedescendant to read focused option while navigating
  by keyboard
- Add aria-selected="true" to the selected list option
- Set aria-autocomplete="none" to the country code button element
  since displayed options do not depend on the number input value
- Allow passing arbitrary props to the country code button element via
  flagDropdownProps prop (for example, "aria-labelledby" property
  can be passed)

Updates dist files (built with node 8.17.0)
@lrocheWB
Copy link

Hello,
any update ? :)

@VladyslavBondarenko
Copy link
Author

I made the changes in a fork and used it instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants