sveltestrap
sveltestrap copied to clipboard
🐛 Offcanvas Edge Case will not render content correctly
Describe the bug
A specific set of conditions when using offcanvas will cause it to not render content. I think it's caused by a order-of-reactivity issue based on the animation implementation within Offcanvas.svelte.
Conditions
- An offcanvas is rendered within another component (say
ComponentA
). -
ComponentA
's slot renders into the Offcanvas slot. - Changing the Offcanvas slot's contents within
ComponentA
duringon:closing
oron:opening
events - Some control flow used as the slot contents of
ComponentA
—such as an if statement.
How to reproduce
Steps to reproduce the behavior:
See this REPL:
https://svelte.dev/repl/1d1fe47e58494908b76d43126018f0f4?version=4.2.12
"Offcanvas 2" has the issue, "Offcanvas 3" has the fix
Additional context
-
Honestly this feels like a moderately obscure bug that will only occur if someone extends offcanvas—so I may try to resolve it and PR the fix—but I doubt it's high priority for anyone.
-
I haven't tested if other svelte versions have the same issue.