fix(core): complete disclosure ARIA wiring in ChatToolCalls#3720
Open
bhamodi wants to merge 1 commit into
Open
fix(core): complete disclosure ARIA wiring in ChatToolCalls#3720bhamodi wants to merge 1 commit into
bhamodi wants to merge 1 commit into
Conversation
|
@bhamodi is attempting to deploy a commit to the Meta Open Source Team on Vercel. A member of the Team first needs to authorize it. |
620b1f9 to
ba09206
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.
Summary
ChatToolCallshad two incomplete disclosure relationships:CallRow, withresultDetail) renderrole="button"+tabIndex={0}and toggle an inline detail panel, but exposed noaria-expandedand noaria-controls, and the detail panel had noid. A screen-reader user heard a plain button with no indication it opens anything or what it controls.aria-expandedbut had noaria-controls, and its content region (the collapsible list of call rows) had noid-- so the toggle ↔ region relationship was implicit only.This wires both up with
useId()-generated ids:CallRow(ChatToolCalls.tsx:366):aria-expanded(only when the row is expandable) +aria-controlson the row, andidon the detail panel. The detail panel is conditionally mounted (rendered only while open), soaria-controlsis set only while the panel is mounted -- it never points at a non-existent id. Matches thearia-controls={... ? ... : undefined}pattern used by the Date inputs (DateInput, etc.) for their conditionally-mounted popovers and theBannerfix (fix(core): link Banner expand toggle to its content via aria-controls #3719).ChatToolCalls.tsx:555):idon the always-mounted content region +aria-controlson the header. Because the region stays mounted (it collapses via CSSgrid-template-rows, not unmount),aria-controlsis unconditional -- matchingSideNavItem.Purely additive; no behavior/visual/role change.
Changes
Chat/ChatToolCalls.tsx:useId()→aria-expanded/aria-controlson expandable call rows +idon the detail panel (set only while mounted);useId()→aria-controlson the group header +idon the content region.Test plan
node_modules/.bin/vitest run --root . packages/core/src/Chat-- 126 pass (10 files), including three newChatToolCallstests (the two disclosure tests confirmed failing before the fix):exposes no aria-expanded on a call row without resultDetail-- a non-expandable row stays a plain row.wires disclosure semantics on an expandable call row-- assertsaria-expanded="false"and noaria-controlswhile collapsed, then after clickaria-expanded="true"andaria-controlsresolving viadocument.getElementByIdto the panel containing the detail content.points the group header aria-controls at the content region-- asserts the header'saria-controlsresolves to the region containing the call rows.node_modules/.bin/tsc --project packages/core/tsconfig.json --noEmit-- clean.node_modules/.bin/eslinton changed files -- clean.Notes
Found during a broader a11y audit of core components. Scoped to one fix per PR. Mirrors the sibling disclosure fixes on
Banner(#3719) andCollapsible(#3707).