Repository navigation
fix(web): expose subtitle swatch selection to screen readers and forced colors - #5922
Open
Tobechukwu-Njoku wants to merge 2 commits into
Open
Tobechukwu-Njoku wants to merge 2 commits into
Tobechukwu-Njoku wants to merge 2 commits into
Conversation
…ed colors Expose the subtitle color swatch palettes in SubtitleAppearanceSettings as radiogroups with radio buttons, aria-checked state, roving tabindex, and direction-aware arrow-key navigation. In forced colors, preserve each swatch's color, frame every swatch with CanvasText, and mark the selected swatch with a Highlight border and an inner Canvas gap (or GrayText when disabled). Co-Authored-By: gemini-4-neon <noreply@google.com>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Contributor
Move ColorPalette and ColorPaletteProps into their own module next to SubtitleAppearanceSettings so the page stays under the 800-line size ratchet (746 lines, down from 826) without changing behavior. Co-Authored-By: gemini-4-neon <noreply@google.com>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Tobechukwu Njoku
Problem
Closes #5779
Related issue: N/A
Validation tasks: none
Other clients: Apple N/A (web settings page); Android N/A (web settings page); Roku N/A (web settings page)
In Settings > Subtitle appearance, the Font color, Outline color, and Background color swatch buttons do not expose which swatch is selected to screen readers, and forced-colors mode (Windows contrast themes) hides the swatches and their selection ring completely. This affects people using screen readers or contrast themes in the web app. This change exposes each palette as a radio group with checked state and keyboard arrow navigation, and keeps swatch colors and selection visible in forced colors.
The swatches previously rendered as plain buttons inside
role="group"withoutaria-checkedoraria-pressed, so assistive technology announced only each color's name. Underforced-colors: active, the browser overrode each swatch's inlinebackground-colorand stripped the box-shadow selection ring, leaving blank rows with no visible color or selection mark.Approach
Exposed each swatch palette in
web/src/pages/settings/SubtitleAppearanceSettings.tsxasrole="radiogroup"withrole="radio"swatches, case-insensitivearia-checkedmatching, rovingtabIndex(omitted when disabled), and direction-aware arrow-key navigation with wrapping. This follows the radio-group pattern used by other mutually exclusive settings controls in the web app rather than toggle buttons witharia-pressed.Marked swatch buttons with
data-slot="color-swatch"and excluded them from the generic selected-radio rule inweb/src/app.css, which would otherwise fill checked radios withHighlightand obscure the swatch color. Under@media (forced-colors: active), swatches keep their own color (forced-color-adjust: none), render a1px solid CanvasTextframe so dark and light swatches stay visible on either canvas, mark the checked swatch with a3px solid Highlightborder and an inner2px Canvasgap (keeping the outer:focus-visibleoutline separate), and switch disabled borders toGrayText.Added unit tests covering all three palettes for radio-group semantics, checked state, click and arrow-key selection, roving
tabIndex, modifier-key handling, and disabled state.Follow-up
4bbb0c48a: extractedColorPaletteinto its own component. Subtitle settings dropped from 826 to 746 lines. Behavior and screenshots are unchanged.Validation
Focused web unit tests for subtitle appearance: failed before the change on
cdf344f9d, passed after onec2bc83fc(4/4).The full web unit test run had three timeouts. All three suites passed on isolated reruns.
Web ESLint, Prettier format check, TypeScript typecheck, production Vite build, and bundle budget check: passed.
Headless Chromium forced-colors check (normal mode, desktop dark/light forced colors, and mobile dark forced colors): confirmed normal-mode appearance is unchanged, and forced colors preserves swatch fills,
CanvasTextframes,Highlight+ innerCanvasselection rings, andGrayTextdisabled borders.On
4bbb0c48a, the size ratchet, bidi and case-collision checks, size-ratchet tests, all four subtitle appearance tests, focused lint and formatting, typecheck, production build, and bundle budget passed.Evidence
Before (
cdf344f9d) vs after (ec2bc83fc) in headless Chromium withforced-colors: active, showing the Font color, Outline color, and Background color palettes on Settings > Subtitle appearance.cdf344f9d)ec2bc83fc)Surface and build: Web UI (desktop and mobile) — Settings > Subtitle appearance (
origin/maincdf344f9dbefore;fix/subtitle-swatch-a11yec2bc83fcafter).Risks
None identified. Normal-mode swatch styling is unchanged, and the forced-colors rules apply only to
[data-slot="color-swatch"].Checklist
AI Disclosure
gemini-4-neon(low thinking for implementation, tests, and resumed draft and evidence verification)ec2bc83fcdiff.gpt-6.2-sol(low effort, T3 Code) approvedec2bc83fcand independently approved the extraction at4bbb0c48awith no findings.Note
Fix subtitle color swatch accessibility for screen readers and forced colors
ColorPalettecomponent in ColorPalette.tsx, with radiogroup/radio semantics,aria-checkedstate, and roving-tabindex arrow-key navigation with wrappingCanvasTextborder, checked swatches get a thickerHighlightborder, and disabled swatches useGrayTextHighlightfill to swatches withdata-slot="color-swatch"or radio-prefixed slots; verify no other swatch variants relied on that ruleMacroscope summarized 4bbb0c4.