diff --git a/.changeset/eleven-swans-swim.md b/.changeset/eleven-swans-swim.md new file mode 100644 index 0000000..f1db4f6 --- /dev/null +++ b/.changeset/eleven-swans-swim.md @@ -0,0 +1,5 @@ +--- +"vaul-svelte": patch +--- + +fix: reset background color on close diff --git a/src/lib/internal/vaul.ts b/src/lib/internal/vaul.ts index 7a78483..bbdc732 100644 --- a/src/lib/internal/vaul.ts +++ b/src/lib/internal/vaul.ts @@ -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, {