Skip to content

Commit ea8e26c

Browse files
fix: dialog overlay opacity does not match design spec (#47)
Co-authored-by: Ona <no-reply@ona.com>
1 parent df888b3 commit ea8e26c

3 files changed

Lines changed: 26 additions & 2 deletions

File tree

src/components/ui/alert-dialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function AlertDialogOverlay({
3030
<AlertDialogPrimitive.Backdrop
3131
data-slot="alert-dialog-overlay"
3232
className={cn(
33-
"fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
33+
"fixed inset-0 isolate z-50 bg-black/50 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
3434
className
3535
)}
3636
{...props}

src/components/ui/dialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function DialogOverlay({
3131
<DialogPrimitive.Backdrop
3232
data-slot="dialog-overlay"
3333
className={cn(
34-
"fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
34+
"fixed inset-0 isolate z-50 bg-black/50 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
3535
className
3636
)}
3737
{...props}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { describe, it, expect } from "vitest";
2+
import { readFileSync } from "fs";
3+
import { join } from "path";
4+
5+
/**
6+
* Regression test for issue #47: dialog overlays must use bg-black/50
7+
* per the design spec. bg-black/10 is nearly invisible and breaks
8+
* the modal focus effect.
9+
*/
10+
describe("dialog overlay opacity matches design spec", () => {
11+
const uiDir = join(__dirname);
12+
13+
it("DialogOverlay uses bg-black/50", () => {
14+
const source = readFileSync(join(uiDir, "dialog.tsx"), "utf-8");
15+
expect(source).toContain("bg-black/50");
16+
expect(source).not.toContain("bg-black/10");
17+
});
18+
19+
it("AlertDialogOverlay uses bg-black/50", () => {
20+
const source = readFileSync(join(uiDir, "alert-dialog.tsx"), "utf-8");
21+
expect(source).toContain("bg-black/50");
22+
expect(source).not.toContain("bg-black/10");
23+
});
24+
});

0 commit comments

Comments
 (0)