Skip to content

🐛 fix(radio, slider): 強制カラーモードでも選択中の点と塗りの範囲が見えるようにする - #403

Merged
touyou merged 2 commits into
mainfrom
fix/forced-colors-radio-slider
Nov 13, 2026
Merged

touyou merged 2 commits into
mainfrom
fix/forced-colors-radio-slider

Conversation

@touyou

@touyou touyou commented Nov 13, 2026

Copy link
Copy Markdown
Member

Requested by touyou · project thread

概要

Windows のハイコントラストなどの強制カラーモード(forced-colors: active)では、ブラウザが background-color を地の色(Canvas)に置き換えます。Radio の選択中の点と Slider の塗りの範囲・トラックは背景色だけで描かれているため、このモードでは消えていました。Radio は、どれが選ばれているか分からなくなっていました。

Google Chrome の Modern Web Guidance のガイド(tabs / visual-design)とコンポーネントを突き合わせた監査で見つかったものです。

変更内容

  • Radio: 選択中の点を forced-color-adjust: none にし、システムカラーの Highlight(無効時は GrayText)で塗る。内側の白丸は Canvas
  • Slider: 塗りの範囲も同様に Highlight / GrayText で塗る
  • Slider: トラックに、強制カラーモードのときだけアウトライン(outline-1)を付ける。border と違って寸法が変わらないので、塗りの太さも変わらない
  • テストと CHANGELOG(Unreleased / Fixed)

通常の表示は変わりません(forced-colors: の付いたクラスしか足していないため)。

動作確認

  • prettier --check / eslint(変更ファイル)
  • pnpm build:package が通る
  • pnpm test(822 passed)
  • Storybook を Playwright の forcedColors: 'active' で開き、変更前と変更後を撮って比べた(Form/Radio の Default・Disabled、Form/Slider の Default・Disabled)。変更前は選択中の点と塗りが消えていて、変更後は見えること、通常の表示が同じままであることを確かめた

セルフレビューリスト

  • テストコードが記載されていますか?
  • アクセシビリティチェックを実施しましたか?(強制カラーモードでの見え方を確認)
  • item.json、Code Connect、README、Storybook は API が変わらないので対象外です

関連 Issue


Generated by Claude Code

- Radio の選択中の点を forced-color-adjust: none にして Highlight(無効時は GrayText)で塗る。内側は Canvas
- Slider の塗りの範囲も同様に Highlight / GrayText で塗る
- Slider のトラックに、強制カラーモードだけ寸法を変えないアウトラインを付ける
- 対応するテストと CHANGELOG を追加

Co-Authored-By: touyou <465697+touyou@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016SVVD5GJ18QmXQmiobfwBA
Copilot AI balanced review requested due to automatic review settings November 13, 2026 04:59
@vercel

vercel Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
sparkle-design Ready Ready Preview Nov 13, 2026 5:10am UTC

Request Review

@touyou touyou self-assigned this Nov 13, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T05:01:54.071511Z 92e9282 PR opened
🔒 Security Review ✅ Completed 2026-11-13T05:01:31.923856Z 92e9282 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 92e928244e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/components/ui/radio/index.tsx Outdated
Comment on lines +130 to +132
isDisabled: {
true: "",
false: "",
true: "forced-colors:bg-[GrayText]!",
false: "forced-colors:bg-[Highlight]!",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Honor group-level disabled state for the forced-color dot

When callers disable the entire group with <Radio disabled>, Radix propagates that state to each item, but RadioItem still passes its own defaulted disabled={false} into this variant. A checked item in such a disabled group therefore receives Highlight rather than GrayText in forced-colors mode and appears enabled; derive this styling from the item's propagated data-disabled state or pass the group state through context.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

f1ebc61 で対応しました。data-disabled を見て切り替える形にしています。


Generated by Claude Code

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

🟡 Changes recommended

Radio items disabled through their group incorrectly render selected indicators with enabled-state Highlight instead of GrayText in forced-colors mode because the styling ignores the group’s disabled state.

1 open issue
What changed in this PR

強制カラーモードでも Sparkle Design の Radio の選択状態と Slider の塗り・トラックを視認できるようにする修正です。通常表示や公開 API は変更しません。

Changes:

  • Radio の選択中の点と Slider の塗りにシステムカラーを指定。
  • Slider のトラックに、寸法を変えない強制カラーモード専用のアウトラインを追加。
  • 関連クラスの回帰テストと CHANGELOG を追加。
File Description
src/​components/​ui/​slider/​index.tsx 塗りのシステムカラーとトラックのアウトラインを追加。
src/​components/​ui/​slider/​index.test.tsx トラック・塗り・無効時のクラスを検証。
src/​components/​ui/​radio/​index.tsx 選択中の点と内側の円にシステムカラーを指定。
src/​components/​ui/​radio/​index.test.tsx 選択中・項目単位の無効時のクラスを検証。
CHANGELOG.md 強制カラーモードでの表示修正を記録。

Review effort: Balanced

Comment thread src/components/ui/radio/index.tsx Resolved
- 点の色を RadioItem の disabled prop ではなく、Radix が付ける data-disabled で切り替える
- Radio(グループ)側の disabled でもテストする

Co-Authored-By: touyou <465697+touyou@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016SVVD5GJ18QmXQmiobfwBA

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

🟢 Approval recommended

No active review issues remain for the Radio and Slider forced-colors visibility changes.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@touyou
touyou merged commit 6a29df4 into main Nov 13, 2026
4 checks passed
@touyou
touyou deleted the fix/forced-colors-radio-slider branch November 13, 2026 05:14

This branch was successfully deployed

1 active deployment
Preview — f1ebc610 Deployed Nov 13, 2026 by vercel[bot]
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.

3 participants