Skip to content

fix(x-table): integer columns shorthand yields truly equal columns#265

Merged
avanelsas merged 2 commits into
mainfrom
fix/x-table-columns-equal-width
Jun 10, 2026
Merged

fix(x-table): integer columns shorthand yields truly equal columns#265
avanelsas merged 2 commits into
mainfrom
fix/x-table-columns-equal-width

Conversation

@avanelsas

Copy link
Copy Markdown
Owner

Problem

x-table's columns="N" shorthand expanded to grid-template-columns: repeat(N,1fr). A bare 1fr track keeps a min-content floor, so any column whose cell holds wide or unbreakable content — a long string, a View/Delete button — bulges past its 1/N share and the columns come out uneven. To an author who typed columns="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 columns was correctly set to 7.

Fix

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 over-wide content shrinks / ellipsises rather than inflating its column. This is what columns="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.cljsparse-columns integer branch emits repeat(N,minmax(0,1fr)); docstring explains the 1fr floor gotcha.
  • model_test.cljs / x_table_test.cljs — updated expectations (browser serialises 00px).
  • docs/x-table.md — attribute table + Layout section document the equal-column behavior and the rationale.

Verification

  • clj-kondo --lint — 0 warnings/errors
  • npx shadow-cljs compile test — 0 warnings
  • npm test (karma) — 5151 SUCCESS
  • npx shadow-cljs release lib — Closure Advanced, 0 warnings
  • Adapter regeneration (pre-commit) produced no drift — API surface unchanged.

🤖 Generated with Claude Code

`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>
@avanelsas avanelsas merged commit 2e5324b into main Jun 10, 2026
1 check passed
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.

1 participant