Skip to content

fix(layout): handle vertical spacers and narrow padding - #115

Merged
lloydrichards merged 1 commit into
codex/fix-flex-exhaustedfrom
codex/fix-layout-edge-cases
Sep 6, 2026
Merged

lloydrichards merged 1 commit into
codex/fix-flex-exhaustedfrom
codex/fix-layout-edge-cases

Conversation

@lloydrichards

@lloydrichards lloydrichards commented Sep 5, 2026 •

Copy link
Copy Markdown
Owner

Goal and scope

Make spacers consume the active Flex axis and keep narrow Containers within their declared width. Container height enforcement is out of scope.

Description

Vertical spacers now allocate rows instead of columns. Horizontal padding is capped when it cannot fit inside the requested width.

How to test

  • Review this after stacked dependency fix(layout): allow zero flex allocation #110.
  • Run bun run --cwd packages/effect-boxes test tests/layout.test.ts.
  • Check weighted spacers, gaps, zero remaining space, zero-width Containers, and tuple padding.

Review

  • Gatekeeping: Check correctness, tests, quality, and design before merge.
  • Knowledge sharing: Quick intent and implementation review; light feedback is enough.
  • Pair session: Review the remaining decisions together.

Closes #103
Closes #105

@vercel

vercel Bot commented Sep 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
effect-boxes-docs Ready Ready Preview Sep 6, 2026 8:05am UTC

@changeset-bot

changeset-bot Bot commented Sep 5, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d2e6d82

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
effect-boxes Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The changes are well-scoped to the reported layout issues and are backed by focused regression tests for the key edge cases.

Pull request overview

This PR fixes two layout edge cases in the Layout module: Flex.spacer now consumes space along the active flex axis (so it works correctly in Flex.col), and Container.make clamps horizontal padding so the container never exceeds its declared width (including narrow/zero widths).

Changes:

  • Update flex child resolution so Flex.spacer allocates height in Flex.col (rows) rather than width (cols).
  • Clamp Container’s horizontal padding to fit within the declared container width, keeping innerWidth and output width consistent.
  • Add targeted tests for weighted spacers, gaps, zero remaining space, and narrow/tuple padding; publish a patch changeset.
File summaries
File Description
packages/effect-boxes/tests/layout.test.ts Adds regression tests for spacer allocation in rows/cols and container padding clamping.
packages/effect-boxes/src/internal/flex.ts Makes spacer allocation axis-aware (rows for col, cols for row) and supports weighted spacers.
packages/effect-boxes/src/internal/container.ts Clamps horizontal padding to ensure container output width never exceeds options.width.
.changeset/swift-animals-juggle.md Declares a patch release describing the behavior fixes.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +118 to +120
Match.tag("Fill", (c) =>
c.builder === spacerBuilder ? makeSpacer(size) : c.builder(size)
),
@lloydrichards
lloydrichards force-pushed the codex/fix-layout-edge-cases branch from aa641cb to d2e6d82 Compare September 6, 2026 08:03
@lloydrichards
lloydrichards merged commit 4b220ff into main Sep 6, 2026
2 of 3 checks passed
@lloydrichards
lloydrichards deleted the codex/fix-layout-edge-cases branch September 6, 2026 08:04
@github-actions github-actions Bot mentioned this pull request Sep 6, 2026

This branch was successfully deployed

1 active deployment
Preview — d2e6d827 Deployed Sep 6, 2026 by vercel[bot]
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.

fix(layout): Container padding exceeds its declared width fix(layout): Flex.spacer expands horizontally in a column

2 participants