diff --git a/.changeset/heavy-boats-drive.md b/.changeset/heavy-boats-drive.md new file mode 100644 index 000000000..1cd623307 --- /dev/null +++ b/.changeset/heavy-boats-drive.md @@ -0,0 +1,5 @@ +--- +"bits-ui": patch +--- + +fix: `avoidCollisions` in Floating UI components diff --git a/packages/bits-ui/src/lib/bits/utilities/floating-layer/useFloatingLayer.svelte.ts b/packages/bits-ui/src/lib/bits/utilities/floating-layer/useFloatingLayer.svelte.ts index 305c3353d..8857a1179 100644 --- a/packages/bits-ui/src/lib/bits/utilities/floating-layer/useFloatingLayer.svelte.ts +++ b/packages/bits-ui/src/lib/bits/utilities/floating-layer/useFloatingLayer.svelte.ts @@ -145,14 +145,14 @@ class FloatingContentState { mainAxis: this.#sideOffset.current + this.#arrowHeight, alignmentAxis: this.#alignOffset.current, }), - this.#avoidCollisions && + this.#avoidCollisions.current && shift({ mainAxis: true, crossAxis: false, limiter: this.#sticky.current === "partial" ? limitShift() : undefined, ...this.detectOverflowOptions, }), - this.#avoidCollisions && flip({ ...this.detectOverflowOptions }), + this.#avoidCollisions.current && flip({ ...this.detectOverflowOptions }), size({ ...this.detectOverflowOptions, apply: ({ rects, availableWidth, availableHeight }) => {