Skip to content

Commit 1b808e3

Browse files
fix: reset background color on close (#57)
Co-authored-by: Davis SHYAKA <[email protected]> Co-authored-by: Hunter Johnston <[email protected]>
1 parent 8793649 commit 1b808e3

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

.changeset/eleven-swans-swim.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"vaul-svelte": patch
3+
---
4+
5+
fix: reset background color on close

src/lib/internal/vaul.ts

+6
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,12 @@ export function createVaul(props: CreateVaulProps) {
482482
const $direction = get(direction);
483483

484484
if (open) {
485+
// setting original styles initially
486+
set(document.body, {
487+
background: document.body.style.backgroundColor || document.body.style.background,
488+
});
489+
490+
// setting body styles, with cache ignored, so that we can get correct original styles in reset
485491
set(
486492
document.body,
487493
{

0 commit comments

Comments
 (0)