Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4fe6b5e

Browse files
Move dark class to <html> so portals render with dark tokens (closes #198) (#199)
The Sonner Toaster, DialogContent, and PopoverContent all portal to document.body, escaping the inner <div className="dark …"> wrapper in App.tsx. The dark variant selector (&:is(.dark *)) only matches elements inside a .dark ancestor, so those surfaces resolved :root light values (white backgrounds). Moving the class to <html> makes the dark tokens apply to every portal mounted under <body>. It also prevents a flash of light content on initial load, since the class is present before React mounts. Validated: 291/291 tests pass; vite build succeeds; dev server returns the modified HTML with <html class="dark">.
1 parent f0853bd commit 4fe6b5e

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

client/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<html lang="en">
2+
<html lang="en" class="dark">
33
<head>
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

client/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ export function App() {
562562
projects.find((project) => project.id === mobileHeaderProjectId)?.name ?? "Controller";
563563

564564
return (
565-
<div className="dark flex h-dvh w-full bg-background text-foreground">
565+
<div className="flex h-dvh w-full bg-background text-foreground">
566566
{sidebarOpen && (
567567
<div
568568
className="fixed inset-0 z-30 bg-black/50 md:hidden"

0 commit comments

Comments
 (0)