fix(react): announce collapsed state when dropdown closes#36295
Open
VivekJariwala50 wants to merge 2 commits into
Open
fix(react): announce collapsed state when dropdown closes#36295VivekJariwala50 wants to merge 2 commits into
VivekJariwala50 wants to merge 2 commits into
Conversation
Author
|
@microsoft-github-policy-service agree |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR targets an accessibility gap in the v8 @fluentui/react Dropdown: when the listbox is dismissed, it adds a polite screen reader announcement of the collapsed state (to address Narrator not vocalizing the aria-expanded transition).
Changes:
- Add an
Announcedlive region toDropdownrendering when transitioning from open → closed. - Add a unit test to verify
"collapsed"is announced after dismissing via Escape. - Update the root
jest.config.tsto use an ES import forgetJestProjectsAsync.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/react/src/components/Dropdown/Dropdown.base.tsx | Adds Announced rendering on close to announce the collapsed state. |
| packages/react/src/components/Dropdown/Dropdown.test.tsx | Adds a test asserting a "collapsed" status announcement after Escape dismiss. |
| jest.config.ts | Switches getJestProjectsAsync import style from require to import. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
4fecc0b to
a67f53d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Previous Behavior
When the
Dropdowncomponent is open and dismissed (e.g., by pressing the Escape key or clicking outside), Windows Narrator does not announce the new collapsed state of the combobox. This leaves screen reader users without confirmation that the dropdown has closed, failing accessibility standards (WCAG 2.1 / 2.2 SC 4.1.2 Name, Role, Value).New Behavior
We integrated the standard
@fluentui/reactAnnouncedcomponent inside theDropdownbase rendering. The component monitors state transitions and fires a polite screen reader announcement ("collapsed") when the dropdown is dismissed.An automated unit test has also been added under
packages/react/src/components/Dropdown/Dropdown.test.tsxto verify that the collapsed status is announced upon dismissing the menu.Related Issue(s)