Skip to content

Commit f7fe244

Browse files
committed
fix(CursorTooltip): Prevent overflowing window border
1 parent 079832d commit f7fe244

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/components/ui/tooltip/cursor-tooltip.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { PropsWithChildren, ReactNode, useState } from "react"
22

33
import {
4+
flip,
45
FloatingPortal,
56
offset,
67
shift,
@@ -35,8 +36,12 @@ export const CursorTooltip = ({
3536
const { refs, floatingStyles, context } = useFloating({
3637
open,
3738
onOpenChange: setOpen,
38-
middleware: [offset({ mainAxis: 16, crossAxis: 8 }), shift({ padding: 8 })],
39-
placement: "bottom-start",
39+
middleware: [
40+
offset({ mainAxis: 8, crossAxis: 16 }),
41+
shift({ padding: 8 }),
42+
flip(),
43+
],
44+
placement: "right-start",
4045
})
4146

4247
const { isMounted, styles } = useTransitionStyles(context, {

0 commit comments

Comments
 (0)