diff --git a/src/components/panels/task-board-panel.tsx b/src/components/panels/task-board-panel.tsx index 95df955..41c12f8 100644 --- a/src/components/panels/task-board-panel.tsx +++ b/src/components/panels/task-board-panel.tsx @@ -137,6 +137,7 @@ function MentionTextarea({ const [activeIndex, setActiveIndex] = useState(0) const [query, setQuery] = useState('') const [range, setRange] = useState<{ start: number; end: number } | null>(null) + const [openUpwards, setOpenUpwards] = useState(false) const filtered = mentionTargets .filter((target) => { @@ -178,6 +179,18 @@ function MentionTextarea({ }) } + useEffect(() => { + if (!open) return + const node = textareaRef.current + if (!node) return + + const rect = node.getBoundingClientRect() + const estimatedMenuHeight = Math.min(Math.max(filtered.length, 1) * 46 + 12, 224) + const availableBelow = window.innerHeight - rect.bottom + const availableAbove = rect.top + setOpenUpwards(availableBelow < estimatedMenuHeight && availableAbove > availableBelow) + }, [open, filtered.length]) + return (