Skip to content

fix: give small controls a 24px hit area (WCAG 2.5.8) - #737

Draft
wemra3 wants to merge 11 commits into
mainfrom
fix/touch-targets
Draft

wemra3 wants to merge 11 commits into
mainfrom
fix/touch-targets

Conversation

@wemra3

@wemra3 wemra3 commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Part of the mobile umbrella tailor-inc/platform-planning#2207 (Phase 2, "Many tap targets are smaller than 24 x 24 px (checkbox, tooltip trigger, small tabs, date segments)").

The rule this PR applies: every library control has a hit area of at least 24×24 CSS px on its own, without relying on the spacing exception of WCAG 2.5.8 (Target Size, Minimum). The exception depends on what the consumer places next to the control, which the library cannot guarantee. The look does not change: where the control stays small, the tappable region is extended with a pseudo element or with padding plus a negative margin, so nothing around it moves.

Measured on main (b4ede51) with the vite example at 375 px (iPhone) and 768 px (iPad) touch emulation, 34 pages and 11 interaction states: 10 kinds of controls were under 24 px. Three failed the criterion outright (xs capsule tabs, the dialog close button, breadcrumb links at 375 px); the others only passed through the spacing exception. The breadcrumb is #736.

Changes

One commit per control.

Control Before After How
Checkbox 16×16 16×16 box, 24×24 hit area ::after with a 5px negative inset (measured from the padding box, inside the 1px border). Table cells that hold a checkbox keep 4px on the right instead of 0, so the hit area stays inside the cell when the column is squeezed next to a pinned column.
Date field segments (DateField, DatePicker, DateRangePicker) 23.9×24 at 16px text; 28×20 / 21×20 / 35×20 at 14px text ≥ 24×24 min-h-6 min-w-6 on each spinbutton; the group stays 36px tall.
DescriptionCard copy button 20×20 24×24, 20×20 footprint p-1.5 with -my-0.5 -mr-0.5.
Dialog close button 16×16 24×24 p-1, offset 12px instead of 16px so the icon stays put.
Combobox chip remove 16×16 24×24, 16×16 footprint p-1.5 -m-1.
BadgeList "+N" trigger 31×20 (22 in a table) hit area 24 (26) tall ::after adding 2px above and below.
DataTable sub-row caret 20×20 24×24, 20×20 footprint size-6 -m-0.5.
Tabs capsule size="xs" 20px tall, icon-only 20×20 24px tall, icon-only 24×24 Tab min-h-6 min-w-6; the track uses p-0.5 instead of p-1, so it stays 28px and aligned with Button xs.

Behavior change: the active capsule of an xs tab list is 4px taller than before (24px inside a 28px track). A table checkbox column has 4px of right padding instead of 0, which shows only when the column is squeezed to its minimum width (28 → 32px at 375 px); at normal widths the 52px column is unchanged.

Docs: a sentence on the Checkbox and Tabs pages. A patch changeset.

Results

Playwright (Chrome, touch emulation) on the vite example, before (main at b4ede51) and after. "Hit area" is measured with elementFromPoint stepping 0.5px outwards from each edge of the control, so it is a lower bound; the computed ::after box is also listed for the pseudo-element cases.

Control (375 px) Box before → after Hit area before → after
Checkbox, table row (pinned column next to it) 16×16 → 16×16 16.5×16.5 → 23.5×24 (::after 24×24)
Checkbox, select all 16×16 → 16×16 16.5×16.5 → 23.5×24 (::after 24×24)
BadgeList +N (card) 31.6×20 → 31.6×20 32.1×20.5 → 32.1×24 (::after 31.6×24)
DescriptionCard copy 20×20 → 24×24 20.5×20.5 → 24.5×24.5
Date segment, day 23.9×24 → 24×24 24.4×24.5 → 24.5×24.5
Sub-row caret 20×20 → 24×24 20.5×20.5 → 24.5×24.5
Tabs xs, icon-only 20×20 → 24×24 20.5×20.5 → 24.5×24.5
Tabs xs, text 40.8×20 → 40.8×24 41.3×20.5 → 41.3×24.5
Dialog close 16×16 → 24×24 16×16.5 → 24×24.5
Combobox chip remove 16×16 → 24×24 16.5×16.5 → 24.5×24.5

768 px gives the same numbers, except the date segments start at 20px tall (14px text) and the +N trigger at 22px.

Across all 34 example pages and 11 states, interactive elements with a bounding box under 24 px went from 614 to 360 (both viewports together). What remains: the breadcrumb links (#736), the 16px checkbox boxes (their hit area is now 24px, which a bounding-box survey does not see), the input inside Combobox.Chips (the 36px chips group is the real target), the example page's native range sliders, and links inside running text.

Full tables: hit-before.md / hit-after.md and targets.md in the measurement folder (attached as needed).

Screenshots

Each pair is a 160×96 px crop at 375 px, before (main) and after. Red outline: the control's box. Blue dashed outline: the ::after hit area where one is used.

  • Checkbox in a table row: pr-b/crops/checkbox-row_before.png → checkbox-row_after.png
  • xs capsule tabs: tabs-xs_before.png → tabs-xs_after.png
  • Dialog close: dialog-close_before.png → dialog-close_after.png
  • Date segment: date-segment_before.png → date-segment_after.png
  • Sub-row caret: sub-rows-caret_before.png → sub-rows-caret_after.png
  • DescriptionCard copy: description-card-copy_before.png → description-card-copy_after.png
  • Combobox chip remove: combobox-chip-remove_before.png → combobox-chip-remove_after.png
  • BadgeList +N: badge-list-plus_before.png → badge-list-plus_after.png

Checks

  • pnpm fmt, type-check, lint, test (3,095 core tests after merging main at c90cdf6, 19 snapshots updated for the class changes), docs:sync and docs:check pass. check-dts not run (no declaration changes).
  • New tests, one per control, assert the classes that make the hit area (happy-dom has no layout; the sizes above come from the Playwright runs): Checkbox keeps size-4 and has the ::after inset; every date segment has min-h-6 min-w-6; the copy button, dialog close, chip remove and sub-row caret have their padding and negative margins; the +N trigger has its ::after; xs capsule tabs are min-h-6 with a p-0.5 track while sm keeps p-1.
  • Not checked on a physical phone yet.

Not in this PR

  • Breadcrumb links (20px tall, wrapping at 375 px): fix(breadcrumb): keep the header trail on one line and readable on phones #736.
  • The filter chip remove button in DataTable and the Sonner toast close button were not measured (no chip or toast could be produced in the example run); statically the chip button is 24px wide and as tall as the chip.
  • Links inside running text and the example app's native range inputs: covered by the inline and user-agent exceptions of WCAG 2.5.8.

🤖 Generated with Claude Code

Hiroki Uemura added 10 commits November 16, 2026 10:21
The 16px box keeps its size; an absolutely positioned `::after` with a 5px
negative inset (measured from the padding box, inside the 1px border) makes
the tappable region 24×24 (WCAG 2.5.8 target size). Table cells that hold a
checkbox keep 4px on the right instead of 0 so the hit area stays inside the
cell when the column is squeezed to its minimum width next to a pinned column.
The day segment was 23.9px wide at 16px text and every segment was 20px tall
at 14px text. `min-h-6 min-w-6` keeps each spinbutton at least 24×24 inside
the 36px group; only the focused segment's background grows.
…alue

`p-1.5` makes the button 24×24; negative margins keep its 20×20 footprint so
the value and the icon stay where they were.
The close button was the bare 16px icon. 4px of padding and a 12px offset keep
the icon where it was and give it a 24×24 target.
`p-1.5` makes the remove button 24×24; a negative margin keeps its 16×16
footprint, so chips keep their size.
A pseudo element adds 2px above and below the 20px trigger without changing
the badge row's height.
The caret button is 24×24 with a 2px negative margin, so it still takes one
indent step and child rows line up as before.
`size="xs"` tabs were 20px (icon-only 20×20 with a 2px gap, which fails WCAG
2.5.8 even with the spacing exception). The tab is now at least 24×24 and the
track uses `p-0.5`, so the track stays 28px and still aligns with Button xs.
The active capsule is 4px taller than before.
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Code Metrics Report

main (e4b5616) #737 (f4651e7) +/-
Coverage 62.9% 62.9% +0.0%
Test Execution Time 4m29s 3m31s -58s
Details
  |                     | main (e4b5616) | #737 (f4651e7) |  +/-  |
  |---------------------|----------------|----------------|-------|
+ | Coverage            |          62.9% |          62.9% | +0.0% |
  |   Files             |            294 |            294 |     0 |
  |   Lines             |          13513 |          13514 |    +1 |
+ |   Covered           |           8505 |           8509 |    +4 |
+ | Test Execution Time |          4m29s |          3m31s |  -58s |

Code coverage of files in pull request scope (66.1% → 66.4%, patch 100.0%)

Files Coverage +/- Patch Coverage Status
dist/auth-context-DKJ0CX7P.js 0.0% -46.2% - affected
packages/core/dist/auth-context-CAYVarrG.js 46.1% +46.1% - affected
packages/core/src/components/badge-list/badge-list.tsx 100.0% 0.0% - modified
packages/core/src/components/checkbox/checkbox.tsx 100.0% 0.0% - modified
packages/core/src/components/combobox/combobox.tsx 97.7% 0.0% - modified
packages/core/src/components/data-table/sub-rows-cell.tsx 100.0% 0.0% - modified
packages/core/src/components/date-field/date-input-group.tsx 85.4% 0.0% - modified
packages/core/src/components/description-card/field-renderers.tsx 86.5% +1.8% - modified
packages/core/src/components/dialog/dialog.tsx 97.2% 0.0% - modified
packages/core/src/components/table/table.tsx 100.0% 0.0% - modified
packages/core/src/components/tabs/tabs.tsx 100.0% 0.0% 100.0% modified

Reported by octocov

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

# Conflicts:
#	docs-manifest.json
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