Skip to content

fix(channels-settings): localize log and edit dialog close labels - #19519

Merged
DeJeune merged 2 commits into
mainfrom
SiinXu/fix-channel-dialog-close-i18n-20260826
Aug 27, 2026
Merged

fix(channels-settings): localize log and edit dialog close labels#19519
DeJeune merged 2 commits into
mainfrom
SiinXu/fix-channel-dialog-close-i18n-20260826

Conversation

@SiinXu

@SiinXu SiinXu commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Branch strategy

  • Active development targets main.

What this PR does

Before this PR:

Channel log and edit dialogs in Settings → Channels used the shared DialogContent close control with a hard-coded English sr-only label (Close). In a Chinese UI, screen readers and accessibility inspectors announced Close while the rest of the dialog was already localized.

After this PR:

DialogContent accepts closeLabel. The channel log and edit dialogs pass t('common.close'), so a Chinese UI names the close control 关闭 and an English UI keeps Close.

Fixes #19518

Why we need it and why it was done in this way

Localized interfaces should not expose an English-only accessible name on a dialog close control. The primitive stays language-agnostic with an English default for stories and unlocalized callers; product dialogs pass the existing common.close key.

The following tradeoffs were made:

QR login dialogs in ChannelForms still use the primitive default. This PR only covers the reported log and edit dialogs.

The following alternatives were considered:

Hard-coding Chinese in the primitive was rejected because the UI package does not own i18n. Adding a visible footer Close button was rejected because the existing control is the top-right close button with an sr-only name.

Links to places where the discussion took place: None.

Breaking changes

None.

Special notes for your reviewer

DEV record recvqyjY6Q1syp. Head 5a442b38983049159d88cdb8ca81732316ac9650.

Accessible-name contract is owned by the real packages/ui Dialog primitive tests (names the close control Close by default, uses a caller-provided closeLabel as the close control name). Those cases fail if the default sr-only name changes or if closeLabel is ignored.

The ChannelDetail renderer case that queried common.close against a local @cherrystudio/ui stand-in was removed: it never opened the dialogs, asserted translation keys, and would still pass if production DialogContent ignored closeLabel. The ChannelDetail mock no longer recreates a close-button accessible name. Remaining ChannelDetail tests cover create/edit/close behavior, not a11y naming.

Focused tests: packages/ui/src/components/primitives/__tests__/dialog.test.tsx, src/renderer/pages/settings/ChannelsSettings/__tests__/ChannelDetail.test.tsx. pnpm lint and pnpm test:lint passed locally after the test repair.

Checklist

This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR.
Approvers are expected to review this list.

Release note

Localized the close control name on channel log and edit dialogs so it follows the selected app language.

The shared DialogContent close control used a hard-coded English
sr-only label, so Chinese channel log and edit dialogs announced
"Close". Pass t('common.close') through a closeLabel prop.

Fixes #19518

Signed-off-by: Siin Xu <31815270+SiinXu@users.noreply.github.com>
@SiinXu
SiinXu requested a review from kangfenmao as a code owner August 26, 2026 17:44
@cursor

cursor Bot commented Aug 26, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_af391218-20b9-4caf-bd4f-0bdce25e7ae1)

@claude

claude Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Reviewed the changes. This is a focused, backward-compatible accessibility fix:

  • DialogContent gains an optional closeLabel (default 'Close'), wired into the sr-only accessible name — default preserves prior behavior for unlocalized callers/stories, so no regressions.
  • The channel log/edit dialogs pass closeLabel={t('common.close')}; that i18n key exists in en-us.json, and the closeLabel={t('common.close')} convention is already used across the codebase (ProviderSettingsDrawer, ModelSettings, KnowledgePageDetailSection, etc.), so both usages match the established pattern.
  • Test coverage for the primitive default, a localized override, and the two channel dialogs is sound; no new i18n keys were added, so no locale re-sync was needed.

No correctness, data, security, contract, or migration concerns were identified in this PR.

ChannelDetail was asserting translation keys against a local
DialogContent stand-in. The packages/ui dialog tests already prove
default and custom accessible names on the real primitive.

Signed-off-by: Siin Xu <31815270+SiinXu@users.noreply.github.com>
@cursor

cursor Bot commented Aug 26, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_cefe56f5-dda0-46ed-9976-063c1b0dd792)

@claude

claude Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Review complete. No correctness, data, security, contract, or migration findings. The closeLabel prop is cleanly destructured (no DOM leak), the common.close key exists in all locales, and the default 'Close' preserves behavior for all other DialogContent callers. The removed ChannelDetail assertion was mock-only and behavior-pinning (it could pass even if the primitive ignored the label), so the packages/ui accessible-name tests are the right home for that contract.

@cherry-ai-bot cherry-ai-bot Bot 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.

Cherry Review · 通过

无 findings

@kangfenmao kangfenmao left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@DeJeune
DeJeune merged commit 2300214 into main Aug 27, 2026
24 of 25 checks passed
@DeJeune
DeJeune deleted the SiinXu/fix-channel-dialog-close-i18n-20260826 branch August 27, 2026 21:13
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.

[Bug]: Channel log and edit dialogs name the close control Close in Chinese UI

3 participants