Repository navigation
Conversation
🦋 Changeset detectedLatest commit: c45a0c9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit c45a0c9. Configure here.
| aria-label="trigger children" | ||
| aria-expanded={open} | ||
| // With visible text, that text is the button's name. Icon-only: a generic name. | ||
| aria-label={children ? undefined : 'Toggle section'} |
There was a problem hiding this comment.
Decorative icons leak into trigger name
Medium Severity
Removing the forced aria-label names the trigger from its contents, but Icon still sets aria-label to the icon identifier. SidebarCollapsibleTitle and IconWrapper render those icons inside the trigger without aria-hidden, so a titled section with an icon is announced as the icon name plus the label rather than the visible label alone.
Reviewed by Cursor Bugbot for commit c45a0c9. Configure here.
Chromatic Storybook
Built from commit: Statuses as of the end of the run. The build link shows the live review state. |
XOP
left a comment
There was a problem hiding this comment.
Thank you for contribution! ✨
Please check and address small notes.
| return ( | ||
| <EmptyButton | ||
| onClick={onClick} | ||
| aria-label="trigger children" |
There was a problem hiding this comment.
Removing the forced aria-label here lets decorative icons into the trigger's name:
<SidebarCollapsibleTitle label="Services" icon="code">gives "code Services".- The
Sidebar/CollapsibleTitlePlayground story gives "code Queries". <Collapsible.Trigger icon="settings">Advanced settings</Collapsible.Trigger>gives "settings Advanced settings".
It's worth checking further.
Suggested fix: add aria-hidden to the Icon elements that are affected, as this PR does for the chevron.
Please also add this check in SidebarCollapsibleTitle.test.tsxand keep toHaveAccessibleName('Services').
| name="chevron-right" | ||
| data-open={open.toString()} | ||
| size="sm" | ||
| aria-hidden |
There was a problem hiding this comment.
Nit: no test reaches this end chevron. When I removed this aria-hidden, all 8 tests still passed. A test like the one at Collapsible.test.tsx:52, using <Collapsible.Trigger indicatorDir="end">Advanced settings</Collapsible.Trigger> and expecting the name "Advanced settings", would catch it.


Description
Collapsible.Triggerhad two screen-reader problems:aria-expanded, so assistive technology could not tell whether the section was open.aria-label="trigger children"replaced the button's visible text, so a trigger showing "Advanced settings" was announced as "trigger children" (WCAG 2.5.3 Label in Name, 4.1.2 Name, Role, Value).SidebarCollapsibleTitlerenders this trigger, so every collapsible sidebar section was announced that way. The decorative chevron (role="img",aria-label="chevron-right") was also part of the name.Changes:
aria-expanded={open}on the trigger.aria-label: a trigger with visible text is named by that text; an icon-only trigger gets "Toggle section". A consumer'saria-labelstill overrides it, because{...props}is spread after.aria-hidden.aria-expandedtoggles; icon-only, visible-text and consumeraria-labelnames;SidebarCollapsibleTitleis named by its label.Good to know
aria-controlsis not added:Collapsible.Contentunmounts when closed, so there is nothing to point at while collapsed. Happy to follow up if you'd like it handled differently.Checklist
Contribution
buildandbuild-storybookwork locallyAccessibility
aria-labelTested:
yarn vitestfor Collapsible and SidebarCollapsibleTitle (8 passed),yarn lint:code(0 errors), Storybook Accessibility panel on Sidebar / CollapsibleTitle → Playground (0 violations), keyboard pass (Tab, Enter).Not tested:
yarn build/build-storybook; real screen readers (VoiceOver / NVDA).Note
Low Risk
Accessibility-only patch on Collapsible trigger markup; no visual or behavioral UI change beyond correct ARIA. Tests may need updates only if they queried the old "trigger children" name.
Overview
Fixes Collapsible.Trigger screen-reader behavior without changing visuals.
The trigger now sets
aria-expandedfrom the open state, removes the hard-codedaria-label="trigger children"so visible trigger text becomes the accessible name (icon-only triggers get "Toggle section"; consumeraria-labelstill wins via prop spread), and marks the chevronaria-hiddenso it is not read as "chevron-right".SidebarCollapsibleTitlebenefits because its label is passed as trigger children.New unit tests cover
aria-expandedtoggling, naming for icon-only / text / override cases, and sidebar title accessibility. Patch changeset for@clickhouse/click-ui.Reviewed by Cursor Bugbot for commit c45a0c9. Bugbot is set up for automated code reviews on this repo. Configure here.