Skip to content

fix(notebook): render db selector dropdown via portal so it isn't clipped#178

Merged
debba merged 1 commit intoTabularisDB:mainfrom
ymadd:fix/notebook-db-selector-overflow
May 11, 2026
Merged

fix(notebook): render db selector dropdown via portal so it isn't clipped#178
debba merged 1 commit intoTabularisDB:mainfrom
ymadd:fix/notebook-db-selector-overflow

Conversation

@ymadd
Copy link
Copy Markdown
Contributor

@ymadd ymadd commented May 10, 2026

Summary

  • The notebook SQL cell's database selector dropdown (introduced in feat: Make database selector dropdowns scrollable after 10 entries #160) is rendered with position: absolute inside NotebookCellWrapper, which has overflow-hidden. As a result, when a connection manages many databases (e.g., a single MySQL host with dozens of schemas), the dropdown's max-h-[230px] scroll area is clipped by the cell's bounding rect — particularly noticeable on short cells (no result yet, collapsed neighbors, or the last cell in a notebook), where lower entries become unreachable and the scrollbar isn't visible.
  • This PR renders the dropdown through a React portal (createPortal to document.body) with position: fixed, computed from the trigger button's getBoundingClientRect(). Position is also recomputed on scroll (capture) and resize, matching the existing pattern in src/components/ui/Select.tsx.
  • Visual styling, max-h-[230px] overflow-y-auto behavior, backdrop click-to-close, and the show-only-when-selectedDatabases.length > 1 condition are all preserved.

Why

Without this change, overflow-hidden on the cell wrapper visually clips the absolutely-positioned dropdown regardless of its inner overflow-y-auto, defeating the scroll added in #160 whenever the cell is shorter than the dropdown.

Test plan

  • pnpm typecheck passes
  • pnpm tauri dev — connect to a MySQL host with many databases (>12) and select multiple in the connection dialog
  • Open a Notebook tab, add an SQL cell, click the database selector in the cell header
  • Confirm the dropdown extends past the cell's visual bottom and scrolls to reach all databases
  • Confirm position updates correctly when the notebook scroll container is scrolled and on window resize
  • Confirm clicking outside / on the backdrop closes the dropdown

The cell wrapper has overflow-hidden, which clipped the absolutely
positioned database selector dropdown when many databases existed.
Render the dropdown through a portal with fixed positioning computed
from the trigger button so the full list (with its 230px scroll area)
is reachable regardless of cell height.
@debba
Copy link
Copy Markdown
Collaborator

debba commented May 11, 2026

Good catch, will merge it, thanks for your contribution.

@debba debba merged commit 052cf21 into TabularisDB:main May 11, 2026
1 check passed
@ymadd ymadd deleted the fix/notebook-db-selector-overflow branch May 11, 2026 16:03
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