Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion apps/roam/src/components/DiscourseNodeMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ const NodeMenu = ({
);
const menuRef = useRef<HTMLUListElement>(null);
const [activeIndex, setActiveIndex] = useState(0);

useEffect(() => {
menuRef.current?.children[activeIndex]?.scrollIntoView({
block: "nearest",
});
}, [activeIndex]);
const [isOpen, setIsOpen] = useState(!trigger);

const onSelect = useCallback(
Expand Down Expand Up @@ -259,7 +265,11 @@ const NodeMenu = ({
enforceFocus={false}
onInteraction={trigger ? handlePopoverInteraction : undefined}
content={
<Menu ulRef={menuRef} data-active-index={activeIndex}>
<Menu
ulRef={menuRef}
data-active-index={activeIndex}
className="max-h-[60vh] overflow-y-auto"
>
{discourseNodes.map((item, i) => {
const nodeColor =
formatHexColor(item?.canvasSettings?.color) || "#000";
Expand Down
Loading