Skip to content

Commit bc50f0b

Browse files
committed
fix negative x edgecase
1 parent 5ed85d5 commit bc50f0b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/kit-headless/src/components/popover/floating.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,10 @@ export const FloatingPopover = component$((props: PropsOf<'div'>) => {
6666
if (isRTL) {
6767
const documentWidth = document.body.getBoundingClientRect().width;
6868
const popoverWidth = popover.getBoundingClientRect().width;
69+
const boundaryX = Math.max(x, 0);
6970

7071
Object.assign(popover.style, {
71-
right: `${documentWidth - x - popoverWidth}px`,
72+
right: `${documentWidth - boundaryX - popoverWidth}px`,
7273
top: `${y}px`,
7374
transform: context.transform,
7475
});

0 commit comments

Comments
 (0)