Skip to content

Commit 01ee865

Browse files
authored
Fixed examples being *always* mounted, this should only be done for SSR purposes and is not recommended for tooltips and popovers (#98)
1 parent 9efb600 commit 01ee865

File tree

2 files changed

+30
-38
lines changed

2 files changed

+30
-38
lines changed

src/routes/(inner)/examples/popovers/Example.svelte

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,19 @@
4747
Click Me
4848
</button>
4949
<!-- Floating Element -->
50-
<div
51-
bind:this={floating.elements.floating}
52-
style={floating.floatingStyles}
53-
{...interactions.getFloatingProps()}
54-
class="floating"
55-
>
56-
{#if open}
57-
<div
58-
class="bg-surface-500 text-white p-8 max-w-sm rounded shadow-xl"
59-
transition:fade={{ duration: 200 }}
60-
>
61-
<p>
62-
You can press the <kbd class="kbd">esc</kbd> key or click outside to
63-
<strong>*dismiss*</strong> this floating element.
64-
</p>
65-
<FloatingArrow bind:ref={elemArrow} context={floating.context} class="fill-surface-500" />
66-
</div>
67-
{/if}
68-
</div>
50+
{#if open}
51+
<div
52+
bind:this={floating.elements.floating}
53+
style={floating.floatingStyles}
54+
{...interactions.getFloatingProps()}
55+
class="floating bg-surface-500 text-white p-8 max-w-sm rounded shadow-xl"
56+
transition:fade={{ duration: 200 }}
57+
>
58+
<p>
59+
You can press the <kbd class="kbd">esc</kbd> key or click outside to
60+
<strong>*dismiss*</strong> this floating element.
61+
</p>
62+
<FloatingArrow bind:ref={elemArrow} context={floating.context} class="fill-surface-500" />
63+
</div>
64+
{/if}
6965
</div>

src/routes/(inner)/examples/tooltips/Example.svelte

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,19 @@
4747
Hover Me
4848
</button>
4949
<!-- Floating Element -->
50-
<div
51-
bind:this={floating.elements.floating}
52-
style={floating.floatingStyles}
53-
{...interactions.getFloatingProps()}
54-
class="floating"
55-
>
56-
{#if open}
57-
<div
58-
class="bg-surface-500 text-white p-8 max-w-sm rounded shadow-xl"
59-
transition:fade={{ duration: 200 }}
60-
>
61-
<p>
62-
A <strong>floating element</strong> is one that floats on top of the UI without disrupting
63-
the flow, like this one!
64-
</p>
65-
<FloatingArrow bind:ref={elemArrow} context={floating.context} class="fill-surface-500" />
66-
</div>
67-
{/if}
68-
</div>
50+
{#if open}
51+
<div
52+
bind:this={floating.elements.floating}
53+
style={floating.floatingStyles}
54+
{...interactions.getFloatingProps()}
55+
class="floating bg-surface-500 text-white p-8 max-w-sm rounded shadow-xl"
56+
transition:fade={{ duration: 200 }}
57+
>
58+
<p>
59+
A <strong>floating element</strong> is one that floats on top of the UI without disrupting the
60+
flow, like this one!
61+
</p>
62+
<FloatingArrow bind:ref={elemArrow} context={floating.context} class="fill-surface-500" />
63+
</div>
64+
{/if}
6965
</div>

0 commit comments

Comments
 (0)