Skip to content

fix(editor): cap the function-tree category grid so the item list stays reachable - #593

Merged
Aymericr merged 1 commit into
mainfrom
fix/function-tree-header-cap
Aug 4, 2026
Merged

fix(editor): cap the function-tree category grid so the item list stays reachable#593
Aymericr merged 1 commit into
mainfrom
fix/function-tree-header-cap

Conversation

@Aymericr

@Aymericr Aymericr commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

The defensive fix I offered @yanrin13 in #562. That issue's bug is in our hosted RoomsPanel, which isn't in this repo — but the same layout shape exists here and is reachable.

The shape

FunctionTreePanel renders root categories as grid shrink-0 grid-cols-5 with aspect-square tiles (function-tree-panel.tsx:124), above the only scroller in the panel:

<div className="min-h-0 flex-1 overflow-y-auto p-3">   // :240

Column count is fixed at 5, so row count is ceil(functionTree.length / 5) and each row is as tall as it is wide. Because the header is shrink-0, flex-1 on the list resolves toward zero as the header grows — past roughly 20 categories the list is off-panel with no way to scroll it back.

Why this one and not its sibling

The other header in this panel family, furnishTools (items-panel/index.tsx:197), is the same shrink-0 pattern but is a static 6-item array in ui/action-menu/furnish-tools.tsx — bounded by code, so it can't reach this state. I left it alone.

functionTree is different: it's a prop, supplied by the embedder (items-panel/index.tsx:60, functionTree: FunctionTreeNode[]), so its length crosses the embedding boundary and this package can't bound it. That's exactly the invariant #562 broke — a header whose height is driven by data rather than by code.

Fix

-<div className="grid shrink-0 grid-cols-5 gap-1.5 border-border/70 border-b p-2">
+<div className="grid max-h-[40%] shrink-0 grid-cols-5 gap-1.5 overflow-y-auto border-border/70 border-b p-2">

The header degrades to scrolling instead of consuming the panel. No visual change at today's category counts — max-h only engages once the grid would exceed 40% of panel height.

One note: I first wrote this with subtle-scrollbar, the class the hosted app and several components here use alongside overflow-y-auto. It has no definition anywhere in this repo — it comes from the hosted app's stylesheet — so including it would have been a silent no-op. Dropped it; the scrollbar is the browser default, consistent with other open-source-side scrollers.

Gates

check 1600 files clean · check-types 9/9 · test 12/12

🤖 Generated with Claude Code


Note

Low Risk
Small layout/CSS fix in the items sidebar with no auth, data, or API changes.

Overview
Caps the embedder-supplied root category tile grid in FunctionTreePanel so a large functionTree cannot grow the header past the panel and squeeze the item list to zero height.

The root grid gains max-h-[40%] and overflow-y-auto, so extra categories scroll inside the header instead of stealing space from the only main scroller below. A comment documents that functionTree is unbounded and aspect-square tiles make row count scale with data.

No behavior change at typical category counts—the limit only applies when the grid would exceed ~40% of panel height.

Reviewed by Cursor Bugbot for commit 9382208. Bugbot is set up for automated code reviews on this repo. Configure here.

…ys reachable

The root-category grid is `grid shrink-0` with `aspect-square` tiles over
`functionTree`, which is embedder-supplied and unbounded. Row count grows
with the taxonomy while the item list below is the only scroller, so past
about 20 categories at 5 columns the list is pushed out of the panel and
nothing can scroll it back.

Same shape as the hosted "By room" panel bug in #562. `furnishTools` (the
other header in this panel family) is a static 6-item array, so it cannot
reach this state; this one can, because the array crosses the embedding
boundary.

Cap the grid at 40% of panel height and let it scroll independently. No
visual change at today's category counts.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Aymericr
Aymericr merged commit e2aa4fa into main Aug 4, 2026
2 checks passed
@Aymericr
Aymericr deleted the fix/function-tree-header-cap branch August 4, 2026 23:43
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.

1 participant