feat(layout): add overflow and scroll support to layout and renderer#72
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 11508394da
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| contentWidth: normalizeI32NonNegative(maxX - minX), | ||
| contentHeight: normalizeI32NonNegative(maxY - minY), |
There was a problem hiding this comment.
Compute scrollable extent from content origin
measureContentBounds derives contentWidth/contentHeight as max - min, and resolveOverflow later clamps scrollX/scrollY from that span; this drops the offset between the viewport origin and the first child when children are laid out away from the content origin (for example via signed margins), so the computed max scroll can be too small to ever reveal the right/bottom edge (and too large when children start negative, allowing blank overscroll). In those layouts, valid content becomes permanently unreachable even though it overflows the viewport.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in f35ac21.
I changed measureContentBounds to compute content extents from the container content origin (cx/cy) instead of span (max - min), and updated row/column/box callers to pass the content origin. This fixes under-clamping when content starts at a positive offset and avoids blank overscroll when content starts negative.
Added regression coverage in layout.edgecases.test.ts (scroll clamp uses content-origin extent when children start after origin).
Validation run after the fix:
npm run lintnpm run typechecknode scripts/run-tests.mjs(2410/2410 pass)
Summary
visible|hidden|scroll) and validatedscrollX/scrollYinputs forbox/row/columnscrollX,scrollY,contentWidth,contentHeight,viewportWidth, andviewportHeight(-scrollX, -scrollY)VirtualList/Table/Tree) into layout metadata during rendering as an incremental migration pathdocs/guide/layout.mdTests
layout.overflow-hidden.test.ts(19 tests)layout.overflow-scroll.test.ts(26 tests)layout.scroll-hitTest.test.ts(13 tests)layout.edgecases.test.tsValidation
npm run buildnpm run typechecknode scripts/run-tests.mjs(pass: 2409/2409)