Skip to content

ENG-1742 Add max height and scroll for node type menu#1019

Merged
trangdoan982 merged 4 commits into
mainfrom
eng-1742-add-max-height-and-scroll-for-node-type-menu
May 15, 2026
Merged

ENG-1742 Add max height and scroll for node type menu#1019
trangdoan982 merged 4 commits into
mainfrom
eng-1742-add-max-height-and-scroll-for-node-type-menu

Conversation

@trangdoan982

@trangdoan982 trangdoan982 commented May 11, 2026

Copy link
Copy Markdown
Member

https://www.loom.com/share/2c6b19da26f345a488119a7fe028e4d8

Summary

  • Adds max-h-[60vh] overflow-y-auto to the node type menu so it doesn't overflow off-screen when there are many node types
  • Scrolls the active item into view when navigating with arrow keys, so keyboard navigation works correctly in a scrollable menu

Fixes ENG-1742

Test plan

  • Open the node menu (e.g. on a graph with many node types like discourse-graphs graph)
  • Verify the menu is capped in height and scrollable
  • Navigate with arrow keys and verify the active item scrolls into view
  • Verify mouse selection and keyboard shortcut selection still work as expected

Made with Cursor

Adds `max-h-[60vh] overflow-y-auto` to the node menu list so it doesn't
overflow off-screen when there are many node types. Also scrolls the
active item into view when navigating with arrow keys.

Co-authored-by: Cursor <cursoragent@cursor.com>
@linear-code

linear-code Bot commented May 11, 2026

Copy link
Copy Markdown

ENG-1742

@supabase

supabase Bot commented May 11, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project zytfjzqyijgagqxrzbmz because there are no changes detected in packages/database/supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

Comment on lines +326 to +328
const parentTop =
props.textarea.parentElement?.getBoundingClientRect().top ?? 0;
const menuMaxHeight = window.innerHeight - (parentTop + coords.top) - 24;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The menuMaxHeight calculation can result in negative or extremely small values when there is insufficient vertical space below the menu position. This will cause the menu to be unusable or invisible.

Unlike the second calculation at lines 377-380 which uses Math.max(..., 100) to ensure a minimum height, this calculation has no safeguard.

Fix:

const menuMaxHeight = Math.max(
  window.innerHeight - (parentTop + coords.top) - 24,
  100
);
Suggested change
const parentTop =
props.textarea.parentElement?.getBoundingClientRect().top ?? 0;
const menuMaxHeight = window.innerHeight - (parentTop + coords.top) - 24;
const parentTop =
props.textarea.parentElement?.getBoundingClientRect().top ?? 0;
const menuMaxHeight = Math.max(
window.innerHeight - (parentTop + coords.top) - 24,
100
);

Spotted by Graphite

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i actually prefer without the max option, because that means all nodes will be visible within the view
image

if we set the max between the calculated value and 100, then user might still be unable to see the bottom of the list

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I enabled flipping from the Popover and here's the updated behavior
https://www.loom.com/share/1dfdf25d641f410b8f0d9f971d943820

@trangdoan982 trangdoan982 requested a review from mdroidian May 13, 2026 00:19

@mdroidian mdroidian left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's try to use the built in <Popover> position prop to deal with where is should render, instead of trying to render a very very small scrollable menu.

Comment on lines +326 to +328
const parentTop =
props.textarea.parentElement?.getBoundingClientRect().top ?? 0;
const menuMaxHeight = window.innerHeight - (parentTop + coords.top) - 24;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@trangdoan982 trangdoan982 requested a review from mdroidian May 13, 2026 20:20
@trangdoan982 trangdoan982 merged commit d99f23f into main May 15, 2026
9 checks passed
@trangdoan982 trangdoan982 deleted the eng-1742-add-max-height-and-scroll-for-node-type-menu branch May 15, 2026 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants