fix(x-table): integer columns shorthand yields truly equal columns#265
Merged
Conversation
`columns="N"` expanded to `repeat(N,1fr)`, but a bare `1fr` track keeps a `min-content` floor — a column holding wide/unbreakable content (a long string, a button) bulges past its 1/N share and the columns come out uneven, which reads as the attribute being ignored. Expand the integer shorthand to `repeat(N,minmax(0,1fr))` instead. The `minmax(0,1fr)` floor of 0 removes the intrinsic-minimum constraint, so the N tracks are genuinely equal and content shrinks/ellipsises rather than overflowing — which is what `columns="N"` is meant to express. Explicit template strings are still passed through unchanged for per-column sizing. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
x-table'scolumns="N"shorthand expanded togrid-template-columns: repeat(N,1fr). A bare1frtrack keeps amin-contentfloor, so any column whose cell holds wide or unbreakable content — a long string, aView/Deletebutton — bulges past its1/Nshare and the columns come out uneven. To an author who typedcolumns="7"and got mismatched column widths, it reads like the attribute is being ignored.This surfaced in the BareBuild demo: a 7-column table with action buttons rendered with two visibly different trailing columns even though
columnswas correctly set to7.Fix
Expand the integer shorthand to
repeat(N, minmax(0,1fr))instead. Theminmax(0,1fr)floor of0removes the intrinsic-minimum constraint, so the N tracks are genuinely equal and over-wide content shrinks / ellipsises rather than inflating its column. This is whatcolumns="N"is meant to express.Explicit template strings (e.g.
columns="2fr 1fr 120px") are still passed through unchanged for deliberate per-column sizing.Changes
model.cljs—parse-columnsinteger branch emitsrepeat(N,minmax(0,1fr)); docstring explains the1frfloor gotcha.model_test.cljs/x_table_test.cljs— updated expectations (browser serialises0→0px).docs/x-table.md— attribute table + Layout section document the equal-column behavior and the rationale.Verification
clj-kondo --lint— 0 warnings/errorsnpx shadow-cljs compile test— 0 warningsnpm test(karma) — 5151 SUCCESSnpx shadow-cljs release lib— Closure Advanced, 0 warnings🤖 Generated with Claude Code