Skip to content

fix(sonner): make close button visible on light and dark toasts#3769

Open
RushikeshGandhmal wants to merge 3 commits intodubinc:mainfrom
RushikeshGandhmal:fix/sonner-close-button-visibility
Open

fix(sonner): make close button visible on light and dark toasts#3769
RushikeshGandhmal wants to merge 3 commits intodubinc:mainfrom
RushikeshGandhmal:fix/sonner-close-button-visibility

Conversation

@RushikeshGandhmal
Copy link
Copy Markdown

@RushikeshGandhmal RushikeshGandhmal commented Apr 17, 2026

Description

Sonner's toast close button renders with opacity: 0.4 by default and inherits background/border colors from the toast theme. On light toasts the icon blends into the surface; on dark/colored toasts the inherited dark background makes the button nearly invisible.

Changes

apps/web/styles/globals.css

  • Added a scoped CSS override targeting [data-sonner-toast] [data-close-button]
  • Pins opacity: 1, background: white, color: #374151, and border-color: #e5e7eb so the close button is always visible regardless of toast theme

Why

Sonner doesn't expose a prop to control close button appearance per-theme. The only reliable fix is a CSS override scoped to the toast container — this avoids touching the Sonner internals while keeping the button consistent across all toast variants.

Screenshots

Before

image

After

image

Summary by CodeRabbit

  • Bug Fixes
    • Fixed styling of toast notification close buttons to ensure proper visibility and consistent appearance across all themes.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 17, 2026

@RushikeshGandhmal is attempting to deploy a commit to the Dub Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 17, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 00097a24-ba3e-46bd-b097-09fbfa36c600

📥 Commits

Reviewing files that changed from the base of the PR and between 0f13839 and 7bcda95.

📒 Files selected for processing (1)
  • apps/web/styles/globals.css

📝 Walkthrough

Walkthrough

Added explicit CSS styling rules for Sonner toast close buttons to control their opacity, background color, text color, and border color across all toast themes using !important flags.

Changes

Cohort / File(s) Summary
Sonner Toast Close Button Styling
apps/web/styles/globals.css
Added CSS rule for [data-sonner-toast] [data-close-button] with forced opacity, white background, gray text color, and light border styling.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A close button now shines so bright,
With crisp white background catching light,
The gray text whispers, borders gleam,
Toasts dismiss with CSS dream! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing visibility of Sonner toast close buttons across light and dark themes by adding CSS styling.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@RushikeshGandhmal
Copy link
Copy Markdown
Author

@steven-tey can you please review the PR?

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.

2 participants