Skip to content

fix(grid): justify-self baseline aligns columns via orthogonal synth - #1

Draft
julia-script wants to merge 4 commits into
mainfrom
jo/grid-justify-items-self-200a
Draft

fix(grid): justify-self baseline aligns columns via orthogonal synth#1
julia-script wants to merge 4 commits into
mainfrom
jo/grid-justify-items-self-200a

Conversation

@julia-script

@julia-script julia-script commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Summary

Two fixes from the fuzz-batch loop, starting at the justifyItems/justifySelf enrichment cluster.

1. fix(grid): justify-self baseline — orthogonal column synth

justify-items / justify-self: baseline was treated as start. In a multi-item column baseline-sharing group, Chrome positions from Blink’s Major-group delta (trackBaseline - synthesizedBaseline), reading baselines in an orthogonal writing mode (vertical-lr in LTR, vertical-rl in RTL).

Horizontal-tb items always synthesize there:

  • LTR (vertical-lr, flipped-lines) → synth 0
  • RTL (vertical-rl) → synth = border-box width
  • plus the block-start margin in that mode (margin-left / margin-right)

RTL widths 30+20 share x=70 (not start-per-item 70/80). Spec: css-align-3 §6.1, css-grid-1 §11. Blink @ refs/branch-heads/7922.

2. fix(flex): shrink-to-fit contribution clamps

Non-stretch justify-items revealed that shrink-to-fit (unknown main size + definite available) summed flex bases. A shrinkable empty flex-basis: 55px sized the container to 55 where Chrome gives 0. Stretch hid it by forcing the used size to the track.

Now uses the same §9.9.3 clamps as intrinsic sizing (including style max-*; columns keep flooring by an explicit basis).

Batch progress (rehydrated open set of 917)

Cluster Result
justifyItems/justifySelf 21 fixed, 24 still open
Remaining opens abspos+justifySelf (~9), aspect-ratio+justifyItems (~6), RTL text+ZWSP single-item baseline (~4), other

Test plan

  • Probe matrices: justify-baseline 64/64, flexBasis shrink-to-fit 52/52
  • pnpm test5448 passed, no regressions
  • Regression fixtures fail without their fixes
    • fuzz_grid_justify_baseline_column
    • fuzz_flex_shrink_to_fit_basis
Open in Web Open in Cursor 

`justify-items`/`justify-self: baseline` was treated as start. In a
multi-item column sharing group Chrome positions from Blink's Major-group
delta (`trackBaseline - synthesizedBaseline`), reading baselines in an
orthogonal writing mode (vertical-lr in LTR, vertical-rl in RTL). Horizontal
items always synthesize there: flipped-lines (LTR) yields 0, otherwise the
item's width, plus the block-start margin in that mode.

RTL widths 30+20 now share x=70 instead of sitting at start-per-item
(70/80); LTR margin-left differences shift the whole group. Clears 7
fuzz-batch findings. css-align-3 §6.1, css-grid-1 §11; Blink
ComputeBaselineOffset @ branch-heads/7922.

Co-authored-by: Julia Ortiz <julia-script@users.noreply.github.com>
@vercel

vercel Bot commented Aug 1, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
bento-layout Ready Ready Preview Aug 1, 2026 6:16pm

Request Review

Pins the RTL width-sharing case (30+20 → both at x=70) and the LTR
margin-left group shift. Fails without the orthogonal-synth offset.

Co-authored-by: Julia Ortiz <julia-script@users.noreply.github.com>
cursoragent and others added 2 commits August 1, 2026 18:15
When the flex container's main size is unknown but available space is a
definite length (non-stretched grid item, abspos, root under a viewport),
the shrink-to-fit path summed flex bases. A shrinkable empty
`flex-basis: 55px` item then sized the container to 55 where Chrome gives
0 — revealed by `justify-items: start|end|center` on a grid (stretch hid
it by forcing the used size to the track).

Mirror the content-contribution clamps: explicit basis replaces the style
main size, floors only when non-shrinkable, caps when non-growable, and
honours style max-*. Empty shrinkable row bases collapse to the automatic
minimum; `width: 55` and `flex-basis: 10; width: 55` stay at 55 and 10;
`width: 200; max-width: 1` contributes 1. Columns keep flooring by an
explicit basis (same asymmetry as the §9.9.3 loop).

Co-authored-by: Julia Ortiz <julia-script@users.noreply.github.com>
Pins justify-items:start cases: empty shrinkable basis → 0, flex-shrink:0
keeps the basis, style width contributes, explicit basis caps width, and
max-width clamps the preferred size.

Co-authored-by: Julia Ortiz <julia-script@users.noreply.github.com>
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.

2 participants