Combobox selection announcement #738
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Research:
I found that most accessible combobox examples got this announcement behavior for free because they would autoclose + refocus on the textbox after each selection (which generally had a dynamic label that would get announced with selections). This pattern doesn't align with the comboboxes on the Scorecard measure list page, which only autoclose for single-select comboboxes and have static labels that aren't reflective of the selections made.
I couldn't find any examples of accessible comboboxes with the exact same label AND autoclose/focus behavior as ours, so I chatted with Claude and ChatGPT about it. The main takeaway was that we don't have any live region (visible on the page or to screen readers), that would allow screen readers to pick up on selection changes. A standard practice for addressing this is by adding an aria-live region that's visually hidden and contains the relevant selection info. Using LiveAnnouncer does this all under the hood, so I opted for that since the code is way more intuitive and readable.
Note:
Depending on the type of combobox used, there's a chance that there will be some screen reader redundancy in announcing selections (e.g. with announcing dynamic labels on textbox refocus after selection), but I ran through all of our combobox examples in the demo app and even where some examples had redundancy, it seemed pretty unobtrusive.
Scorecard ticket: https://jiraent.cms.gov/browse/MACS-833