Skip to content

fix(ui): input and textarea placeholders meet WCAG AA contrast - #25562

Closed
matbrgz wants to merge 3 commits into
stablyai:mainfrom
UndefinedDump:fix/input-placeholder-contrast
Closed

matbrgz wants to merge 3 commits into
stablyai:mainfrom
UndefinedDump:fix/input-placeholder-contrast

Conversation

@matbrgz

@matbrgz matbrgz commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

ELI5

The grey hint text inside empty text boxes was too faint to read comfortably. It was a grey that's already meant to be quiet, then made 40% see-through on top of that. This change drops the see-through part, so the hint uses the normal quiet grey and is readable in light and dark mode.

What Changed

  • Before: Input and Textarea placeholders rendered text-muted-foreground/60: 2.30:1 on light, 3.33:1 on dark.
  • After: placeholders render text-muted-foreground at full strength: 4.74:1 on light, 7.07:1 on dark. Both are above the 4.5:1 AA floor for normal text.
  • Mechanism: one class token changes in ui/input.tsx and one in ui/textarea.tsx. A new test, ui/field-placeholder-contrast.test.ts, reads main.css and each component's class string, composites the placeholder and field colors (including dark:bg-input/30 over --background), and asserts at least 4.5:1 for both components in both themes.

Why

The token is already the documented secondary-text tier, so it's the right role for a placeholder. Adding another alpha step only made it fainter. Keeping the fix in the shared primitives covers every field at once without adding a new color. The test derives the ratio from the real tokens and classes, so a later token or opacity change that drops below AA fails CI.

Linked Issue

Fixes #25561

Visual Proof

Before/after screenshots (light and dark) will be attached by the author.

Measured contrast, placeholder vs. field background:

Theme Before After
Light 2.30:1 4.74:1
Dark 3.33:1 7.07:1

Testing

  • pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/ui/field-placeholder-contrast.test.ts

    • Before the fix: 4 failed (light 2.296, dark 3.326 for both Input and Textarea).
    • After the fix: 4 passed.
  • pnpm lint: pass.

  • pnpm typecheck: pass.

  • Full pnpm test not run locally; CI will cover it.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Implemented with Claude Code (Claude Opus 5.5); reviewed by the author.

Review

  • Cross-platform: CSS class only; renders the same on macOS, Linux and Windows.
  • SSH / remote / local: renderer-only; no effect on execution location.
  • Performance: none.
  • Security: none.
  • UI: placeholders get slightly darker in light mode and slightly lighter in dark mode. They are still clearly lighter than entered text (--foreground), so filled and empty fields remain distinguishable. No layout change.

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

placeholder:text-muted-foreground/60 composites to 2.30:1 on the light
field background and 3.33:1 on the dark one (dark:bg-input/30), both
under the 4.5:1 AA floor. The muted-foreground token is already the
de-emphasized tier, so use it at full strength: 4.74:1 light, 7.07:1
dark. A test computes the ratio from main.css and each component's
classes for both themes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

🧰 Additional context used
📚 Code guidelines (1)
AGENTS.md — auto-discovered

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9008237c-6496-4677-a589-dce8511d702e
📥 Commits

Reviewing files that changed from the base of the PR and between e2da3a1 and f29c026.

📒 Files selected for processing (3)
  • src/renderer/src/components/ui/field-placeholder-contrast.test.ts
  • src/renderer/src/components/ui/input.tsx
  • src/renderer/src/components/ui/textarea.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

Input and Textarea placeholders now use full-opacity muted foreground instead of 60% opacity. New tests calculate placeholder contrast against field backgrounds in light and dark themes and require a ratio of at least 4.5:1.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to f29c0

This updates placeholder colors in shared inputs and textareas to meet WCAG AA contrast, and adds tests that guard the result. I found no remaining merge-blocking risk.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: improving Input and Textarea placeholder contrast to meet WCAG AA.
Description check ✅ Passed The description covers the required sections, explains the change and rationale, links issue #25561, and reports focused test results plus lint and typecheck. Visual proof is still pending, and manual…
Linked Issues check ✅ Passed Issue #25561 requires shared Input and Textarea placeholders to meet 4.5:1 contrast in both themes. The PR changes both components to use full-strength text-muted-foreground and adds a regressio…
Out of Scope Changes check ✅ Passed The whole-PR summary identifies changes to the Input and Textarea placeholder classes and a related contrast test. These changes support issue #25561. The summary identifies no unrelated changes.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 3 files.
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog 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.

Important

The new test file fails the changed-code-quality casting gate, so the static analysis and typecheck CI job will be red until the as Rgb assertions are removed. pnpm lint does not run that gate, which is why it passes locally.

Reviewed changes

  • Placeholder contrast fix — Input and Textarea drop the /60 alpha on placeholder:text-muted-foreground, restoring the full --muted-foreground tier (4.74:1 light, 7.07:1 dark). Correct and complete for the two shared primitives.
  • Contrast regression test — a new field-placeholder-contrast.test.ts reads main.css, composites the placeholder and field colors per theme, and asserts ≥4.5:1 for both primitives. It is non-vacuous: reverting the /60 makes all four cases fail at exactly the ratios the issue reports.

ℹ️ Bespoke fields still use sub-AA placeholders

The fix is correct for the shared primitives and closes #25561 as written, but the "covers every field at once" framing is narrower in practice: several fields that bypass Input/Textarea still render placeholders at text-muted-foreground/60 or lower, so they remain under 4.5:1. Worth a follow-up only if the intent is app-wide AA.

Technical details
# Remaining sub-AA placeholder sites

## Affected sites
- `src/renderer/src/components/native-chat/NativeChatComposerField.tsx:280` — `placeholder:text-muted-foreground/60`
- `src/renderer/src/components/settings/RepositoryHookScriptSetting.tsx:204` — `placeholder:text-muted-foreground/60`
- `src/renderer/src/components/right-sidebar/source-control/panel/header-toolbar.tsx:282` — `placeholder:text-muted-foreground/60`
- `src/renderer/src/components/task-page/linear/IssueDialog.tsx:121` — `/40`, and `:131` — `/45`
- `src/renderer/src/components/right-sidebar/SearchFilters.tsx:30,47` — `/50`

## Required outcome
- Decide whether app-wide WCAG AA for placeholders is in scope; if so these need the same treatment or a shared placeholder token.

## Open questions for the human
- Is the goal only the two primitives (issue scope), or every placeholder surface?

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes

  • Dropped the as Rgb casts in the new contrast test: type Rgb is now number[] and both assertions are gone, clearing the changed-code-quality casting gate the prior review flagged. Verified at 4ddf8f3 — the casting scan exits 0 and all four contrast cases pass. The renderer typecheck config does not enable noUncheckedIndexedAccess, so the tuple-to-array relaxation introduces no type error.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@matbrgz

matbrgz commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@matbrgz

matbrgz commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@nwparker

nwparker commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Closing as superseded by #36561, which fixes the built-in color defaults (WCAG AA pairs, light-mode active tab and the TOC scrollbar). Thank you for this PR, it shaped the design.

@nwparker nwparker closed this Nov 2, 2026
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]: Input and Textarea placeholder text falls below WCAG AA contrast in both themes

2 participants