Skip to content

fix(media-library): remove scrollbar from empty media panel - #7

Merged
MeepCastana merged 1 commit into
developfrom
fix/media-panel-empty-scrollbar
Aug 6, 2026
Merged

MeepCastana merged 1 commit into
developfrom
fix/media-panel-empty-scrollbar

Conversation

@OGtwelve

@OGtwelve OGtwelve commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Fixes #5

What

The media panel showed a vertical scrollbar when the library was empty: the py-24 (192px) padding on the empty and loading states made them taller than a short docked panel, and the scroll container applies overflow-y-auto unconditionally.

How

  • media-library.tsx: the scroll container becomes a flex column (flex flex-col added; siblings inside it use paddings only, so no margin-collapse differences).
  • media-grid.tsx: the root grows to fill the column (flex-1 min-h-0 flex flex-col — inert in the grouped usage, whose parent is a block CollapsibleContent), and the empty/loading states switch from fixed py-24 to flex-1 with m-auto centering. m-auto (instead of justify-center) keeps content reachable by scrolling if the panel is ever shorter than the content, avoiding the classic flex-centering clip.
  • The empty state is compacted (64px upload circle, tighter spacing) so it fits the panel at the default editor layout.

[scrollbar-gutter:stable] is kept, per the issue.

Verification

Measured in headless Chromium against the dev server (fresh project, empty library):

Scenario scrollHeight clientHeight Scrollbar
Before, 1440×900 268 251 yes (bug)
After, 1440×900 251 251 no
After, 1440×600 (panel squeezed to 101px) 216 101 yes — content genuinely doesn't fit; m-auto keeps it fully reachable

The empty state stays vertically centered and fully visible at the default layout. Below ~210px of panel height the (compact) content is taller than the panel, so a scrollbar appears because there is real content to scroll — consistent with the issue's principle.

The populated-library path is untouched: same scroll container, grid branch unchanged. I could not drive a real media import headlessly (import uses showOpenFilePicker / file-system handles, which synthetic drag-drop can't provide), so that path is covered by reasoning + the existing unit tests rather than a browser measurement.

Checks

  • lint ✅, check:boundaries ✅, check:deps-contracts ✅, check:legacy-lib-imports
  • test:run: all 1259 tests pass; the only failing suite is editor.test.tsx, which also fails on an unmodified checkout of main in environments without Supabase env vars (its logger mock lacks warn, and src/infrastructure/supabase/client.ts:32 calls logger.warn at import time). Unrelated to this change — happy to fix in a separate one-line PR.

The empty and loading states were padded with py-24 (192px), making them
taller than a short docked panel, so the unconditional overflow-y-auto
container always showed a scrollbar with nothing meaningful to scroll.

Make the scroll container a flex column and let MediaGrid's empty and
loading states fill the available height (flex-1 + m-auto centering)
instead of pushing past it, and compact the empty state (smaller upload
circle, tighter spacing) so it fits the panel at the default editor
layout. m-auto keeps the content reachable by scrolling on panels
shorter than the content itself, avoiding the justify-center overflow
clipping problem.

The grouped-usage grid branch and [scrollbar-gutter:stable] are
untouched, so scrolling with imported media behaves as before.
@MeepCastana
MeepCastana changed the base branch from main to develop August 6, 2026 14:54

@MeepCastana MeepCastana left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed locally on a combined review branch (all six merged clean, no conflicts). CI green. Approved.

@MeepCastana
MeepCastana merged commit 89bc124 into develop Aug 6, 2026
1 check passed
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.

Media panel shows a scrollbar when the library is empty

2 participants