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

Improve autocomplete screen reader support #1578

Merged
merged 7 commits into from
Oct 20, 2021

Conversation

nmanu1
Copy link
Contributor

@nmanu1 nmanu1 commented Oct 19, 2021

Move span with aria-live label to be top-level for the autocomplete component so that it is present on page-load, even with empty content. Add instructions for navigating autocomplete to the search bar. Update the autocomplete component to correctly announce number of autocomplete options found for no results and for sectioned filter search.

Note: there should be no screen reader text for number of options found or autocomplete instructions when the search bar is not active. Also, there should be no announcement for number of options found when user focuses on the search bar and there are no default autocomplete options shown.

J=SLAP-1653, 1402
TEST=manual

Smoke testing with theme test-site to check that screen reader correctly announces instructions and number of autocomplete options found.

@coveralls
Copy link

coveralls commented Oct 19, 2021

Coverage Status

Coverage increased (+0.01%) to 61.223% when pulling 558c366 on dev/autocomplete-screen-reader into 383fb3d on develop.

{{#if hasResults}}
{{#each sections}}
{{translate
phrase='[[resultsCount]] [[label]] autocomplete option found.'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outside the context of filter search, there is no label attribute. I think out of an abundance of caution, we should have a phrase for when label is present and another phrase for when there is no label. Having a single phrase like this, we may run into issues for certain languages when label is the empty string or undefined.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated!

}}
{{/each}}
{{else}}
{{translate phrase='0 autocomplete options found.'}}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to special case this? Or can it be handled by the more generic '[resultsCount]] autocomplete options found' we will have above?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the case where there are no results, there are no sections for filterSearch, so the generic '[resultsCount]] autocomplete options found' would not be reached

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood. But do we need a specific, new phrase in this case? Could we not use

            {{translate
              phrase='[[resultsCount]] autocomplete option found.'
              pluralForm='[[resultsCount]] autocomplete options found.'
              resultsCount=resultsCount
              count=resultsCount
            }}

here too? That would save us having to have an additional translation in Smartling just for this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The resultCount would be 0 here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I can change that

@tmeyer2115 tmeyer2115 merged commit 43ac180 into develop Oct 20, 2021
@nmanu1 nmanu1 mentioned this pull request Nov 16, 2021
nmanu1 added a commit that referenced this pull request Nov 16, 2021
## Version 1.12.0
### Features
- Allow search rate tracking (#1558)
- Add support for setting and changing the visitor and passing it to answers-core (#1564)
- Add support for the auth token that is passed in from the config (#1566)
- Add an `environment` field to support consumer auth in Sandbox (#1597)
- Allow components to override the beforeMount function (#1547)
- Add distance to the card data and a function to format it (#1550)
- WCAG updates (allow pagination with Enter (#1575), identify current page in navigation tab (#1576), update autocomplete screen reader support (#1578, #1579))

### Changes
- Update directAnswers component data to include the searcher (#1596)
- Use custom alerts instead of window.alert (#1549)
- Update Mapbox version to match the Theme (#1551)
- Internal repo changes (#1562, #1577)

### Bugfixes
- Fix console error which would appear on google maps (#1548)
- Fix FAQ expansion when default is expanded (#1553)
- Fix error for searches on page load with no businessId (#1561)
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.

4 participants