Skip to content

fix(DateDetails): make the trigger keyboard accessible - #1348

Open
Beehtrix wants to merge 4 commits into
ClickHouse:mainfrom
Beehtrix:fix/date-details-keyboard-trigger-1346
Open

Beehtrix wants to merge 4 commits into
ClickHouse:mainfrom
Beehtrix:fix/date-details-keyboard-trigger-1346

Conversation

@Beehtrix

@Beehtrix Beehtrix commented Dec 2, 2026 •

Copy link
Copy Markdown

Description

  • DateDetails now passes asChild to Popover.Trigger with an EmptyButton wrapping the existing Link/Text, so the trigger role, aria-haspopup and aria-expanded land on a focusable <button> instead of a div.
  • Tab focuses the trigger, Enter and Space open the popover, and Escape closes it with focus returning to the trigger.
  • The Popover.Trigger default is unchanged.
  • Unit tests cover the button attributes, Tab + Enter, and Space + Escape with focus return. All three fail without the change.

Links and tickets

Refs #1346

Good to know

  • Flyout.Trigger has the same div problem described in the issue. I left it out because changing its default changes the rendered element for every consumer, which AGENTS.md treats as a public API change. Happy to follow up with whichever approach you prefer (new default, or asChild at call sites), which is why this uses "Refs" rather than "Fixes".
  • Visual: the text looks the same. The trigger now shows the EmptyButton focus ring on keyboard focus.
  • Not run: Playwright visual tests (need Docker), storybook:build, and a screen-reader pass.

Checklist

  • Breaking changes? (add migration notes in changesets) None.
  • Visual changes? (specify in changesets) Focus ring on keyboard focus, noted in the changeset.
  • Design review needed?

Contribution

  • Sufficient research before PR
  • Self-reviewed the PR
  • Manually tested the changes (when applies - visual confirmation in Storybook)
  • build and build-storybook work locally (build yes; storybook:build not run)
  • Tests and Stories are aligned with the changes

Accessibility

  • Keyboard - Tab / Enter / Space / Esc covered by unit tests (jsdom); focus returns to the trigger on close
  • Names - the button's accessible name is the visible text (e.g. "5 minutes ago")
  • Vision - focus ring comes from EmptyButton tokens; not checked visually

WCAG 2.2 criteria targeted: 2.1.1 Keyboard, 4.1.2 Name, Role, Value.

yarn typecheck, yarn lint, yarn format, yarn circular-dependency:check, yarn test and yarn build pass locally.


Note

Low Risk
Scoped accessibility change to DateDetails trigger markup with no auth or data-handling impact; visual regression risk is limited to the new keyboard focus ring.

Overview
DateDetails now uses Popover.Trigger with asChild and an EmptyButton around the existing link-styled label, so aria-haspopup, aria-expanded, and the popover trigger semantics live on a real button instead of a non-focusable wrapper.

Keyboard users can Tab to the trigger, open with Enter or Space, and close with Escape (focus returns to the trigger). Appearance is unchanged except for the EmptyButton focus ring on keyboard focus.

Coverage is expanded with unit tests, Storybook play stories (FocusVisible, Keyboard), a changeset, and Playwright selectors updated to getByRole('button').

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

Copilot AI lite review requested due to automatic review settings December 2, 2026 19:06
@changeset-bot

changeset-bot Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0d15a49

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

Copilot AI 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.

🟡 Changes recommended

The change leaves an active critical test-locator failure and lacks required Storybook coverage for the new keyboard-interactive trigger.

2 open issues
What changed in this PR

Updates DateDetails to use a focusable button as its popover trigger, enabling keyboard interaction and proper ARIA semantics.

Changes:

  • Composes Popover.Trigger with EmptyButton.
  • Adds keyboard interaction and focus-return tests.
  • Adds a patch changeset documenting accessibility and visual changes.
File Description
src/​components/​DateDetails/​DateDetails.tsx Uses an EmptyButton-based popover trigger for keyboard accessibility.
src/​components/​DateDetails/​DateDetails.test.tsx Tests button semantics, keyboard interaction, and focus return.
.changeset/​fix-date-details-keyboard-trigger-1346.md Documents the accessibility fix and focus-ring change.

Review effort: Lite

@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 c8e9718. Configure here.

Copilot AI lite review requested due to automatic review settings December 2, 2026 21:45

Copilot AI 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.

🔵 Needs a closer look

The test still uses a CSS tag selector for interactive hover and click actions instead of the repository-required role-based button locator.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Low severity Use a role-based locator for button interactions

tests/​display/​date-details.spec.ts:15

This new locator is used for hover and click interactions, but it still selects the trigger by a CSS tag selector. The repository's visual-test guidance requires role-based locators for interactions; use page.getByRole('button') (scoped to the harness if needed) at the call sites so the test verifies the semantic button rather than silently passing for any matching element.

2 resolved since last review

Review effort: Lite

Copilot AI lite review requested due to automatic review settings December 3, 2026 01:38

Copilot AI 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.

🔵 Needs a closer look

Human assessment is needed because an omitted review finding leaves uncertainty about whether the new interactive-state documentation is adequately verified.

No open issues 🎉

Review effort: Lite

…yboard-trigger-1346

# Conflicts:
#	src/components/DateDetails/DateDetails.test.tsx

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants