Skip to content

Commit

Permalink
[Dialog / Drawer] Workaround Svelte 5 regression with portal'd conten…
Browse files Browse the repository at this point in the history
…t and conditional (sveltejs/svelte#12440)
  • Loading branch information
techniq committed Jul 15, 2024
1 parent 6fe4569 commit 54d9d39
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/real-zebras-compete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte-ux': patch
---

[Dialog / Drawer] Workaround Svelte 5 regression with portal'd content and conditional (https://github.com/sveltejs/svelte/issues/12440)
3 changes: 3 additions & 0 deletions packages/svelte-ux/src/lib/components/Dialog.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
}
</script>

<!-- Separate `{#if}` block works around Svelte 5 regression: https://github.com/sveltejs/svelte/issues/12440 -->
{#if open}
<Backdrop
on:click={() => {
Expand All @@ -80,7 +81,9 @@
fadeParams={{ duration: 150 }}
{portal}
/>
{/if}

{#if open}
<div
class={cls(
'Dialog',
Expand Down
3 changes: 3 additions & 0 deletions packages/svelte-ux/src/lib/components/Drawer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
}
</script>

<!-- Separate `{#if}` block works around Svelte 5 regression: https://github.com/sveltejs/svelte/issues/12440 -->
{#if open}
<Backdrop
on:click={(e) => {
Expand All @@ -48,7 +49,9 @@
class={cls('z-50', settingsClasses.backdrop, classes.backdrop)}
{portal}
/>
{/if}

{#if open}
<!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
<div
class={cls(
Expand Down

0 comments on commit 54d9d39

Please sign in to comment.