sveltestrap icon indicating copy to clipboard operation
sveltestrap copied to clipboard

🐛 Offcanvas Edge Case will not render content correctly

Open RoryDuncan opened this issue 11 months ago • 0 comments

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

  1. An offcanvas is rendered within another component (say ComponentA).
  2. ComponentA's slot renders into the Offcanvas slot.
  3. Changing the Offcanvas slot's contents within ComponentA during on:closing or on:opening events
  4. 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

  1. 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.

  2. I haven't tested if other svelte versions have the same issue.

RoryDuncan avatar Mar 21 '24 21:03 RoryDuncan