Skip to content

Commit

Permalink
fix: reset background color on close (#57)
Browse files Browse the repository at this point in the history
Co-authored-by: Davis SHYAKA <87414827+davis-shyaka@users.noreply.github.com>
Co-authored-by: Hunter Johnston <64506580+huntabyte@users.noreply.github.com>
  • Loading branch information
3 people authored Feb 23, 2024
1 parent 8793649 commit 1b808e3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/eleven-swans-swim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"vaul-svelte": patch
---

fix: reset background color on close
6 changes: 6 additions & 0 deletions src/lib/internal/vaul.ts
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,12 @@ export function createVaul(props: CreateVaulProps) {
const $direction = get(direction);

if (open) {
// setting original styles initially
set(document.body, {
background: document.body.style.backgroundColor || document.body.style.background,
});

// setting body styles, with cache ignored, so that we can get correct original styles in reset
set(
document.body,
{
Expand Down

0 comments on commit 1b808e3

Please sign in to comment.