Skip to content

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

Merged
XOP merged 6 commits into
ClickHouse:mainfrom
jay23606:pr-go/1306-bug-sidebarcollapsibleitem-shows-no-keyb
Dec 2, 2026
Merged

XOP merged 6 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
Contributor

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 focus styling plus display tests; no auth, data, or API changes.

Overview
Fixes missing keyboard affordance on Collapsible / SidebarCollapsibleItem expand triggers by styling :focus-visible on .collapsible__trigger: a 2px outline using --click-global-color-outline-default (with negative offset so clipped parents don’t hide the ring) and visible chevron via [data-trigger-icon] while focused—not only on hover.

Playwright coverage adds Enter/Space toggle behavior on the playground story and light/dark screenshot cases when Tab focuses the closed-main trigger.

Reviewed by Cursor Bugbot for commit a5feb64. 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: a5feb64

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

@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

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
Contributor 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.

@XOP
XOP marked this pull request as ready for review November 30, 2026 14:35
@workflow-authentication-public

Copy link
Copy Markdown
Contributor

Chromatic Storybook

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

Built from commit: a5feb640bcb09ed9e5ad6c639937700f68204381 · Chromatic run

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

@XOP
XOP merged commit c39edcf into ClickHouse:main Dec 2, 2026
11 checks passed
@jay23606
jay23606 deleted the pr-go/1306-bug-sidebarcollapsibleitem-shows-no-keyb branch December 3, 2026 01:11
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