diff --git a/src/lib/bits/link-preview/components/link-preview-content.svelte b/src/lib/bits/link-preview/components/link-preview-content.svelte index 5de9b7c5c..1b47e3a7b 100644 --- a/src/lib/bits/link-preview/components/link-preview-content.svelte +++ b/src/lib/bits/link-preview/components/link-preview-content.svelte @@ -49,19 +49,21 @@ $: builder = $content; $: Object.assign(builder, attrs); - $: updatePositioning({ - side, - align, - sideOffset, - alignOffset, - collisionPadding, - avoidCollisions, - collisionBoundary, - sameWidth, - fitViewport, - strategy, - overlap - }); + $: if ($open) { + updatePositioning({ + side, + align, + sideOffset, + alignOffset, + collisionPadding, + avoidCollisions, + collisionBoundary, + sameWidth, + fitViewport, + strategy, + overlap + }); + } {#if asChild && $open} diff --git a/src/lib/bits/menu/components/menu-content.svelte b/src/lib/bits/menu/components/menu-content.svelte index 6d6a05603..d723006bd 100644 --- a/src/lib/bits/menu/components/menu-content.svelte +++ b/src/lib/bits/menu/components/menu-content.svelte @@ -48,19 +48,21 @@ $: builder = $menu; $: Object.assign(builder, attrs); - $: updatePositioning({ - side, - align, - sideOffset, - alignOffset, - collisionPadding, - avoidCollisions, - collisionBoundary, - sameWidth, - fitViewport, - strategy, - overlap - }); + $: if ($open) { + updatePositioning({ + side, + align, + sideOffset, + alignOffset, + collisionPadding, + avoidCollisions, + collisionBoundary, + sameWidth, + fitViewport, + strategy, + overlap + }); + } {#if asChild && $open} diff --git a/src/lib/bits/popover/components/popover-content.svelte b/src/lib/bits/popover/components/popover-content.svelte index e9af3c3ed..995bfb42a 100644 --- a/src/lib/bits/popover/components/popover-content.svelte +++ b/src/lib/bits/popover/components/popover-content.svelte @@ -46,19 +46,21 @@ $: builder = $content; $: Object.assign(builder, attrs); - $: updatePositioning({ - side, - align, - sideOffset, - alignOffset, - collisionPadding, - avoidCollisions, - collisionBoundary, - sameWidth, - fitViewport, - strategy, - overlap - }); + $: if ($open) { + updatePositioning({ + side, + align, + sideOffset, + alignOffset, + collisionPadding, + avoidCollisions, + collisionBoundary, + sameWidth, + fitViewport, + strategy, + overlap + }); + } {#if asChild && $open} diff --git a/src/lib/bits/popover/components/popover.svelte b/src/lib/bits/popover/components/popover.svelte index 1e50395b5..bc77e6ad3 100644 --- a/src/lib/bits/popover/components/popover.svelte +++ b/src/lib/bits/popover/components/popover.svelte @@ -35,6 +35,12 @@ open = next; } return next; + }, + positioning: { + gutter: 0, + offset: { + mainAxis: 1 + } } }); diff --git a/src/lib/bits/popover/ctx.ts b/src/lib/bits/popover/ctx.ts index 863a98ea8..5eab16868 100644 --- a/src/lib/bits/popover/ctx.ts +++ b/src/lib/bits/popover/ctx.ts @@ -23,6 +23,10 @@ export function setCtx(props: CreatePopoverProps) { const getAttrs = createBitAttrs(NAME, PARTS); const popover = { ...createPopover({ + positioning: { + placement: "bottom", + gutter: 0 + }, ...removeUndefined(props), forceVisible: true }), diff --git a/src/lib/bits/select/components/select-content.svelte b/src/lib/bits/select/components/select-content.svelte index f8c39c76e..87c42da39 100644 --- a/src/lib/bits/select/components/select-content.svelte +++ b/src/lib/bits/select/components/select-content.svelte @@ -50,19 +50,21 @@ $: builder = $menu; $: Object.assign(builder, attrs); - $: updatePositioning({ - side, - align, - sideOffset, - alignOffset, - collisionPadding, - avoidCollisions, - collisionBoundary, - sameWidth, - fitViewport, - strategy, - overlap - }); + $: if ($open) { + updatePositioning({ + side, + align, + sideOffset, + alignOffset, + collisionPadding, + avoidCollisions, + collisionBoundary, + sameWidth, + fitViewport, + strategy, + overlap + }); + }