Skip to content

fix(Collapsible): show focus ring on keyboard focus of the trigger - #1312

Draft
jay23606 wants to merge 5 commits into
ClickHouse:mainfrom
jay23606:pr-go/1306-bug-sidebarcollapsibleitem-shows-no-keyb
Draft

jay23606 wants to merge 5 commits into
ClickHouse:mainfrom
jay23606:pr-go/1306-bug-sidebarcollapsibleitem-shows-no-keyb

Conversation

@jay23606

@jay23606 jay23606 commented Nov 16, 2026 •

Copy link
Copy Markdown

Bug

SidebarCollapsibleItem (and Collapsible.Trigger) gives no visible focus ring on keyboard focus. The trigger is an EmptyButton, which sets outline: none and has no :focus-visible style. The chevron is also hidden until hover, so keyboard users get no cue that focus is on the expand control.

Change

  • Collapsible.module.css: add a :focus-visible outline on .collapsible__trigger, and reveal the chevron while the trigger is focused.
  • tests/display/sidebar-collapsible-item.spec.ts: add keyboard focus visual checks for the trigger in light and dark, following tests/forms/checkbox.spec.ts (click body, Tab, toBeFocused, screenshot). Also adds an Enter/Space toggle test.
  • Changeset (patch).

Testing

  • Visual regression for sidebar-collapsible-item is the regression check: bash .scripts/bash/playwright-docker sidebar-collapsible-item. The focus snapshots are sidebar-collapsible-item-focus-light.png and sidebar-collapsible-item-focus-dark.png.
  • This run was not completed here. The Docker daemon was not running, so the snapshots are not verified against a run.

Not tested

  • The visual run above, Chromatic, and the a11y addon were not run for this change.
  • Unit tests and typecheck were not run in this environment.

Regression test: focus snapshot cases in tests/display/sidebar-collapsible-item.spec.ts, light and dark.

Fixes #1306


Note

Low Risk
CSS-only accessibility styling and tests; no logic or data-path changes.

Overview
Fixes missing keyboard focus feedback on Collapsible.Trigger (including SidebarCollapsibleItem) by styling :focus-visible on .collapsible__trigger: a 2px outline using --click-global-color-outline-default, with inset outline-offset so the ring stays visible inside overflow-clipping sidebars.

While the trigger has keyboard focus, the expand chevron is now shown (same as on header hover), since it was otherwise hidden until hover.

Adds regression tests that the trigger gets collapsible__trigger and that the module CSS declares the focus ring rule; ships as a patch changeset for @clickhouse/click-ui.

Reviewed by Cursor Bugbot for commit 45e21ed. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit da3bbd6. Configure here.

@changeset-bot

changeset-bot Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f9cca63

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clickhouse/click-ui Patch

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

@XOP
XOP requested review from DreaminDani, XOP and ariser November 17, 2026 09:22
@XOP XOP added bug Something isn't working a11y Accessibility improvements labels Nov 17, 2026
@workflow-authentication-public

Copy link
Copy Markdown
Contributor

Chromatic Storybook

Check Status Link
Storybook ✅ 670 stories published Open Storybook
UI Tests ✅ 670 tests unchanged Open build

Built from commit: 45e21ed24d3888c3a03a07e0137a9a9dc52e6517 · Chromatic run

Statuses as of the end of the run. The build link shows the live review state.

@XOP XOP left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please address the comments

expect(trigger).toHaveClass(styles.collapsible__trigger);
});

it('keeps the focus-visible outline inside clipping wrappers', () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please drop this test,
it breaks under harmless change and misses the real problem

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what would be better instead is a focus case in
sidebar-collapsible-item.spec.ts

i.e. click body, Tab, toBeFocused, screenshot, in light and dark similar to checkbox.spec.ts

A new snapshot will be generated (run VRT)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

No change was needed this round. The focus-outline unit test is no longer in Collapsible.test.tsx, and this round did not touch that file.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

No change was needed this round. The focus check is already in tests/display/sidebar-collapsible-item.spec.ts for light and dark, following the checkbox.spec.ts pattern, with its snapshots committed. I could not run the visual check here because the Docker daemon is not running.

Signed-off-by: jay23606 <4602056+jay23606@users.noreply.github.com>
Signed-off-by: jay23606 <4602056+jay23606@users.noreply.github.com>
Signed-off-by: jay23606 <4602056+jay23606@users.noreply.github.com>
@jay23606

Copy link
Copy Markdown
Author

Both inline comments were already addressed on this branch: the unit test is removed and the focus check is in the Playwright spec for light and dark. This round needed no further code change.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a11y Accessibility improvements bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: SidebarCollapsibleItem shows no keyboard focus and hides its expand chevron until hover

2 participants