Skip to content

fix: exclude fixed gaps from distributed leading space - #6

Open
tristanmuzzu wants to merge 1 commit into
tscircuit:mainfrom
tristanmuzzu:codex/fix-distributed-spacing-with-gaps
Open

tristanmuzzu wants to merge 1 commit into
tscircuit:mainfrom
tristanmuzzu:codex/fix-distributed-spacing-with-gaps

Conversation

@tristanmuzzu

@tristanmuzzu tristanmuzzu commented Sep 7, 2026

Copy link
Copy Markdown

With a nonzero main-axis gap, space-around and space-evenly include that gap in the leading space. For example, a 300px row with 50px and 100px items and a 30px gap places the items at 45/185 instead of 30/170 under space-around. When flex growth consumes the remaining space, the same offset pushes the last item outside the container.

Calculate leading space from the remaining free space alone, while keeping the fixed gap between items. This matches the CSS gap definition. Adds 12 numeric regressions covering rows and columns, both distributions, flex growth, and a single child. The nested SVG snapshot moves only the affected children by 2.5px to remove its existing offset.

Validation: all 12 new tests fail before the fix; all 29 tests pass afterward. Type checking, formatting, build, and git diff --check pass. Prepared and verified with an AI coding assistant.

Fixes #4. The separate overflow-alignment case is covered by #13.

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.

Distributed justification incorrectly adds gap to outer spacing

1 participant