Skip to content

fix(Dialog): name the header close button and forward its test id - #1322

Draft
panbhag wants to merge 1 commit into
mainfrom
fix/dialog-close-button-label
Draft

panbhag wants to merge 1 commit into
mainfrom
fix/dialog-close-button-label

Conversation

@panbhag

@panbhag panbhag commented Nov 20, 2026

Copy link
Copy Markdown

Description

  • The Dialog.Content header close button (rendered with showClose) is icon-only and had no accessible name, so screen readers announced it as just "button". It now has aria-label="Close", the same label Popover uses.
  • CloseButton received data-testid="click-dialog-close" but only accepted onClose, so the test id never reached the DOM. It now passes its remaining props through to CrossButton, after the hardcoded aria-label so consumers can override it.
  • Added a unit test that finds the button by role and name, checks the test id, and checks that clicking it calls onClose and closes the dialog.

Links and tickets

None.

Good to know

  • No visual change: only an ARIA attribute and a data-testid are added.
  • The existing "showClose false" test asserts there is no button named /close/i. Before this change that assertion passed regardless, because the close button had no name. It now checks what it was meant to check.

Checklist

  • Breaking changes? (add migration notes in changesets)
  • Visual changes? (specify in changesets)
  • 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
  • Tests and Stories are aligned with the changes

Ran typecheck, lint, format, circular-dependency:check, test (911 passed), build and storybook:build. Visual tests were not run (no visual change). Not yet checked by hand in Storybook or with a screen reader.

Accessibility

  • Keyboard - every action works with Tab / Enter / Space / Esc; focus is visible and returns to the trigger on close
  • Names — every control has a name that includes its visible label; icon-only controls take aria-label
  • Vision — colors come from tokens, focus ring shows, targets are at least 24×24 px

Checked: WCAG 2.2 4.1.2 Name, Role, Value, through the unit test. Keyboard and vision behavior are unchanged and were not re-tested.

🤖 Generated with Claude Code

The icon-only close button rendered by `showClose` had no accessible name, so screen
readers announced it as "button". It now carries aria-label="Close", matching Popover.
CloseButton also dropped the data-testid it was given; it now passes its props through.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Nov 20, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4fa3b59

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

@workflow-authentication-public

Copy link
Copy Markdown
Contributor

Storybook Preview Deployed

✅ Preview URL: https://click-6sjpndvmv-clickhouse.vercel.app

Built from commit: f7f32dd8543776064d3bce96f26f5c52bda06a18

@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: 4fa3b59218de9f21dd305b1a9fa3afbf45e87a03 · Chromatic run

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

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.

1 participant