Skip to content

fix(ui): keep checked checkbox checkmark legible across themes#9074

Merged
alexcarpenter merged 2 commits into
mainfrom
checkbox-dark-mode-styling
Jul 2, 2026
Merged

fix(ui): keep checked checkbox checkmark legible across themes#9074
alexcarpenter merged 2 commits into
mainfrom
checkbox-dark-mode-styling

Conversation

@alexcarpenter

@alexcarpenter alexcarpenter commented Jul 2, 2026

Copy link
Copy Markdown
Member

Description

Fixes the checked checkbox rendering as a blank filled box in dark themes. Previously the checkmark was baked into an SVG background-image with a hardcoded white fill, which disappeared against the light primary500 box in dark mode. The checkmark is now drawn on a masked ::before overlay whose backgroundColor uses the colorPrimaryForeground theme token, so it stays legible across light, dark, and custom themes. To test, render any checkbox (e.g. the sign-up legal consent checkbox) in a dark appearance and confirm the checkmark is visible when checked.

BEFORE AFTER
Screenshot 2026-07-02 at 1 32 20 PM Screenshot 2026-07-02 at 1 31 52 PM
Screenshot 2026-07-02 at 1 32 46 PM Screenshot 2026-07-02 at 1 33 08 PM

Included light mode to show that still works as expected.

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

  • Bug Fixes
    • Fixed checkbox checkmarks so they remain visible in dark and custom themes.
    • Improved checked-state contrast by aligning the checkmark color with the active theme colors.

@github-actions github-actions Bot added the ui label Jul 2, 2026
@changeset-bot

changeset-bot Bot commented Jul 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 989872f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@clerk/ui Patch
@clerk/chrome-extension Patch
@clerk/swingset Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Jul 2, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Jul 2, 2026 7:26pm
swingset Ready Ready Preview, Comment Jul 2, 2026 7:26pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Repository UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 3b51d984-681d-4fda-a4ed-519da4f8cda6

📥 Commits

Reviewing files that changed from the base of the PR and between 2f73bdd and c8ccd2e.

📒 Files selected for processing (2)
  • .changeset/checkbox-dark-mode-checkmark.md
  • packages/ui/src/primitives/Input.tsx

📝 Walkthrough

Walkthrough

The checkbox checked-state checkmark rendering in Input.tsx was changed from an inline SVG background image with a hardcoded white fill to a CSS mask applied via a ::before pseudo-element, colored using the colorPrimaryForeground theme token. A changeset documents this fix.

Changes

Checkbox checkmark theming

Layer / File(s) Summary
Checkmark mask implementation and changeset
packages/ui/src/primitives/Input.tsx, .changeset/checkbox-dark-mode-checkmark.md
Adds a checkboxCheckmarkMask SVG constant, applies it as a mask via ::before with color from theme.colors.$colorPrimaryForeground, sets checked background to primary color, and documents the fix via a patch changeset.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

A checkbox once was hard to see,
Its checkmark lost in dark decree.
Now masked in light, foreground bright,
It shines through every theme just right! ✅
A rabbit hops with joy tonight~ 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main fix: making the checked checkbox checkmark legible across themes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-07-02T19:28:03.304Z

Summary

Metric Count
Packages analyzed 19
Packages with changes 0
🔴 Breaking changes 0
🟡 Non-breaking changes 0
🟢 Additions 0

No API Changes Detected

All packages have stable APIs with no detected changes.


Report generated by Break Check

Last ran on 989872f.

Comment on lines +41 to +53
'&::before': {
content: '""',
position: 'absolute',
inset: 0,
backgroundColor: theme.colors.$colorPrimaryForeground,
maskImage: checkboxCheckmarkMask,
WebkitMaskImage: checkboxCheckmarkMask,
maskPosition: 'center',
WebkitMaskPosition: 'center',
maskRepeat: 'no-repeat',
WebkitMaskRepeat: 'no-repeat',
maskSize: `${theme.sizes.$2} ${theme.sizes.$2}`,
WebkitMaskSize: `${theme.sizes.$2} ${theme.sizes.$2}`,

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.

love having to do the old masked icon trick for responsive fills 😑

@pkg-pr-new

pkg-pr-new Bot commented Jul 2, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@9074

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@9074

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@9074

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@9074

@clerk/electron

npm i https://pkg.pr.new/@clerk/electron@9074

@clerk/electron-passkeys

npm i https://pkg.pr.new/@clerk/electron-passkeys@9074

@clerk/eslint-plugin

npm i https://pkg.pr.new/@clerk/eslint-plugin@9074

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@9074

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@9074

@clerk/express

npm i https://pkg.pr.new/@clerk/express@9074

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@9074

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@9074

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@9074

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@9074

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@9074

@clerk/react

npm i https://pkg.pr.new/@clerk/react@9074

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@9074

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@9074

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@9074

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@9074

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@9074

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@9074

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@9074

commit: 989872f

@alexcarpenter alexcarpenter merged commit 883ea48 into main Jul 2, 2026
51 checks passed
@alexcarpenter alexcarpenter deleted the checkbox-dark-mode-styling branch July 2, 2026 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants