Skip to content

fix(a11y): hold a Chip to 44px on the axis its label leaves short - #297

Merged
andraderaul merged 1 commit into
mainfrom
fix/chip-target-width
Aug 15, 2026
Merged

fix(a11y): hold a Chip to 44px on the axis its label leaves short#297
andraderaul merged 1 commit into
mainfrom
fix/chip-target-width

Conversation

@andraderaul

Copy link
Copy Markdown
Owner

Follow-up to #295, which noted this in passing but left it alone as out of scope.

A Chip pays for its pointer target in layout rather than in an overlay, because it stands in a
scrolling row of its own kind where a centred overlay would reach into its neighbour's
(ui/touch-target.ts). But only min-h was ever spelled — and a Chip is exactly as wide as its
label, so the width was held by whatever the label happened to be.

- 'flex items-center gap-2xs px-sm py-2xs … min-h-[44px]'
+ 'flex items-center justify-center gap-2xs px-sm py-2xs … min-h-[44px] min-w-[44px]'

What was under the target

Measured in Chrome across both programs at 390px and 900px:

Chip Where Before After
ASCII//Convert, OUT — PNG scale 31×44 (both widths) 44×44
VHS GLITCH//Studio, PRESETS 38×44 (both widths) 44×44
+ add effect GLITCH//Studio, EDIT 29×44 above sm 44×44

The + holds 60px on mobile from its callsite's w-[60px], and loses it to sm:w-auto above the
breakpoint — which is why it only offends at desktop widths.

The fix belongs in the primitive rather than at those three callsites: the next two-character label
would arrive under 44 exactly the same way.

justify-center

It is only observable in the case min-w creates — a flex container wider than its content. Below
that it is inert, since a Chip is sized to its content. Without it, the stretched width falls
entirely to one side of a label that no longer fills it.

The one Chip that sets flex-col (ASCII//Convert's charset chips, where justify-* would act on the
vertical axis instead) was checked rather than assumed: its two lines already fill the 44px box, and
the content insets are unchanged at 7px top and bottom either way.

Verification

Nine chips move across the two programs and four viewport/tab combinations — all width-only, none
in height, and no other chip geometry changes
. Full sweep diffed before/after:

9 >  "w": 44        6 <  "w": 31        2 <  "w": 38        1 <  "w": 29

Full suite green (2138 tests across 5 workspaces), typecheck and Biome clean.

🤖 Generated with Claude Code

A Chip pays for its pointer target in layout rather than in an overlay,
because it stands in a scrolling row of its own kind where a centred
overlay would reach into its neighbour's (`ui/touch-target.ts`). Only
`min-h` was ever spelled, and a Chip is as wide as its label -- so the
width was held by whatever the label happened to be.

Three sat under the target. ASCII//Convert's PNG scale chips `1×` / `2×` /
`4×` draw 31px at both breakpoints, GLITCH//Studio's `VHS` Preset 38px,
and its add-effect `+` 29px above `sm`, where the callsite's `sm:w-auto`
drops the 60px it holds on mobile. The fix belongs in the primitive
rather than at those three callsites: the next two-character label would
arrive under 44 the same way.

`justify-center` comes along because it is only observable in the case
`min-w` creates -- a container wider than its content -- where the slack
would otherwise fall entirely to one side of the label. Verified it is a
no-op for the one Chip that sets `flex-col` (ASCII's charset chips): its
two lines already fill the 44px box, insets unchanged at 7px either side.

Measured across both programs at 390px and 900px: nine chips move, all
width-only, none in height, and no other chip geometry changes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 2, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
ascii-art-converter Ready Ready Preview Aug 2, 2026 3:02pm
atlas-sprawl Ready Ready Preview Aug 2, 2026 3:02pm
cyberdeck-golem Ready Ready Preview Aug 2, 2026 3:02pm
glitch-studio Ready Ready Preview Aug 2, 2026 3:02pm

@andraderaul
andraderaul merged commit 0dc87b9 into main Aug 15, 2026
7 checks passed
@andraderaul
andraderaul deleted the fix/chip-target-width branch August 15, 2026 15:43
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