Repository navigation
fix(a11y): mark pressed toggles with the system highlight in forced colors (#1086) - #1087
Conversation
…olors (#1086) Forced colours replace the background and text colours that set a pressed toggle apart, so the selected category on the leaderboard and compare switchers looked like the others in Windows High Contrast. Draw every [aria-pressed="true"] control with Highlight/HighlightText. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.
Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 14 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Local review (CodeRabbit was rate-limited): the rule lives entirely inside |
Closes #1086
What
In forced-colors mode (Windows High Contrast), the browser replaces the background and text colours that set a pressed toggle apart (
btn-danger text-whitevsbtn-outline-dark bg-light). On the leaderboard and compare category switchers, the selected category therefore looked exactly like the others._custom.scssadds one@media (forced-colors: active)rule. Every[aria-pressed="true"]control gets the systemHighlightbackground andHighlightTexttext (forced-color-adjust: none), and its children are transparent withHighlightText. That keeps count badges readable, for example the selected "Điện thoại 9". Thehtmlprefix outranks Bootstrap's!importantutilities such asbg-whiteon those badges. Normal colour mode is unaffected.Test
e2e/selector-state.spec.ts: underforcedColors: 'active', the pressed and unpressed buttons of the leaderboard and compare category switchers have different backgrounds._custom.scssreverted toorigin/dev, both new tests fail (rgb(255, 255, 255)for both). With the fix,selector-stateandpill-group-statepass 11/11.bg-whitewin and hid the count was caught this way and fixed.🤖 Generated with Claude Code
📌 TL;DR
This PR adds a CSS media query to ensure pressed toggle buttons remain visually distinct in Windows High Contrast Mode (forced colors) by overriding system defaults with
Highlightcolors. It includes a new E2E test to verify that the selected state is visually distinguishable from unselected states under these conditions.🎯 Type of Change
🔍 Changes Walkthrough
apps/web/src/app/style/scss/_custom.scss@media (forced-colors: active)block that targets elements with[aria-pressed='true']. It disablesforced-color-adjustand appliesHighlight/HighlightTextsystem colors to the background, border, and text (including child elements) to ensure the active state is visible in high-contrast modes.apps/web/e2e/selector-state.spec.tsforcedColors: 'active'on the/leaderboardand/comparepages. It asserts that the computedbackgroundColorof a pressed button differs from that of an unpressed button, verifying the visual distinction required by the accessibility fix.📊 Architectural Flow
flowchart TD A[User enables Windows High Contrast / Forced Colors] --> B{Browser applies forced-colors media query} B --> C[CSS Rule: html [aria-pressed='true']] C --> D[forced-color-adjust: none] C --> E[background-color: Highlight !important] C --> F[color: HighlightText !important] E --> G[Pressed button appears distinct from unpressed buttons] F --> G G --> H[E2E Test verifies computed styles differ]