This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
Commit 7d0c174
fix(fields): name the boolean cell's read-only checkbox by its field (objectui#12584) (#12597)
Fixes #12584
Clause-②: no
## What changed
The boolean cell renderer (`BooleanCellRenderer` in
`packages/fields/src/index.tsx`) draws a plain read-only checkbox for
every boolean column outside the completion and status names. That
checkbox had no accessible name, so a screen reader announced each grid
cell as a bare "checkbox, not checked", with no field. It is now named
by the field:
- One local value, `fieldLabel`: the field's label, else its humanized
name. The off badge's text and the checkbox's `aria-label` both read it,
so the expression is written once.
- No state word in the name: the `checkbox` role announces checked or
not checked itself. No new i18n key, no visual change (no class moved),
no prop, export or type change. The `Checkbox` primitive is untouched.
- The humanized fallback reads the field name as authored, not the
lower-cased matching key (A3 below). Matching against the completion
names and `STATUS_FIELD_NAMES` still uses the lower-cased key,
unchanged.
## Mechanism assumptions, measured
- **A1: the primitive forwards `aria-label` to the role element.**
Holds. Every naming pin finds its box with `getByRole('checkbox', { name
})`, which reads the name off the element that carries `role="checkbox"`
(Radix's button), not off a wrapper. The source agrees: the `Checkbox`
wrapper spreads its props onto `CheckboxPrimitive.Root`.
- **A2: the grid hosts add no name of their own.** Holds, read from both
hosts' cell wrappers. The data-table renderer draws `col.cell(...)`
inside a `TableCell` and a `div` that carries only `className`, `title`
and `data-auto-width-key`. `VirtualGrid` wraps it in a `div` with a
class only. Neither sets `aria-labelledby` or `aria-label`, so nothing
is named twice. The card's CDP reading (9 unnamed `checkbox` nodes) is
the runtime face of the same fact.
- **A3: `fieldName` is the lower-cased name.** True. `humanizeLabel`
only capitalises the first letter of each word, so the lower-cased key
read an unlabelled mixed-case name wrong. Measured on `humanizeLabel`
itself (`packages/core/src/utils/humanize-label.ts`):
| name | humanized as authored (now) | humanized lower-cased (before) |
|---|---|---|
| `IsPreferred` | `IsPreferred` | `Ispreferred` |
| `is_preferred` | `Is Preferred` | `Is Preferred` |
| `is_active` | `Is Active` | `Is Active` |
| `IS_ACTIVE` | `IS ACTIVE` | `Is Active` |
So the fallback now reads the name as authored, for the checkbox and the
off badge alike, as the dispatch ruled. For every spec-legal name the
words are byte-identical: the spec refuses an object field name that is
not lowercase snake_case ("Field names must be lowercase snake_case").
The off badge's text moves only for an unlabelled, off-spec status name
with an upper-case letter inside a word (for example `IS_ACTIVE`: "IS
ACTIVE — Off", where it read "Is Active — Off"). `humanizeLabel` does
not split camelCase, by its documented design, so `IsPreferred` reads
`IsPreferred`, not "Is Preferred": the better of the two readings, not a
perfect one.
## Tests
New file
`packages/fields/src/__tests__/booleanCell.accessibleName-12584.test.tsx`.
It renders through `getCellRenderer(resolveCellRendererType(...))`, the
way a grid host resolves a read-mode cell, for both `boolean` and
`toggle`:
- a labelled field, checked and unchecked: `getByRole('checkbox', {
name: 'Preferred' })`;
- an unlabelled field: the humanized name, `Is Preferred`;
- an unlabelled mixed-case name: `IsPreferred` (A3);
- a status field that is on (`is_active`, `true`): the box named
`Active`, the measured HotCRM cell;
- CONTROL: the completion indicator keeps "Completed" / "Not completed"
and draws no checkbox; the off badge keeps "Active — Off" / "Is Active —
Off" and draws no checkbox; a non-boolean value draws the `EmptyValue`
affordance ("No value") and no checkbox.
**Ablation.** The fix was committed first. The mutation went through
`ablation-replace.mjs`, deleting ` aria-label={fieldLabel}`: anchor 1 to
0, blob `8d8a77e75ac8` to `433e77c56102`, on-disk count 0 inside the
run. Result: `Tests 10 failed | 3 passed (13)`. All 10 naming pins went
red with "Unable to find an accessible element with the role "checkbox"
and name ...", and the 3 CONTROLs stayed green. Restore proven: blob
equals HEAD `8d8a77e75ac8`, `git diff HEAD` empty. The test imports
`../index` relatively, so the subject resolves to source, not `dist/`,
and no rebuild was needed for the mutation to reach it.
Runs, local, on a shared box, through the verify lock:
- the new file: `Tests 13 passed (13)` at `63ba527469`;
- every `packages/fields` suite named for boolean (5 files): `Tests 103
passed (103)` at `63ba527469`;
- the whole `@object-ui/fields` suite: `Test Files 257 passed | 1
skipped (258)`, `Tests 4084 passed | 7 skipped (4091)` at `789a28d784`.
The only later commit retypes the new test's render helper (`as any` to
`as never`);
- `pnpm --filter @object-ui/fields type-check`, after building its
dependency closure (11 of 47 projects): exit 0 at `63ba527469`. `tsc -p
tsconfig.test.json --listFiles` lists the new test file;
- the census and ratchet sweep, the suites whose subject this diff
touches (aria-label literal census, icon-only button census,
machine-locale census, ellipsis glyph, emptiness floor, `humanizeLabel`,
grid cell face label, detail section, widget DOM-leak sweep, catalog
gallery render): `Test Files 10 passed (10)`, `Tests 878 passed (878)`
at `789a28d784`.
## Gates
Local subset at the final head `63ba527469`, each exit captured before
any pipe: `check:control-bytes` 0, `check:new-line-citations` 0 (0 new
citations), `check-changeset-presence` 0, `check-changeset-no-major` 0,
`check-changeset-claims` 0, `check-governed-queue-guard --test` NOT
GOVERNED. At `789a28d784`, also 0: `check-changeset-fixed`,
`check-changeset-overwrite`, `check:pending-changeset-literals`,
`check:i18n-keys`, `check:test-path-roots`, the three `check:vi-mock-*`,
`check:comment-mask-corpus`, `check:shell-escape-residue`,
`check-type-check-coverage`. ESLint on the two changed source files: 0
errors, no warning in the changed lines of `index.tsx`, none in the new
test. The full farm is CI's.
## What the landing seat's browser reading should show
HotCRM, the Account list (the runtime list grid; the Studio Records grid
draws the same renderer), the `is_active` column. In the browser's
accessibility tree (CDP `Accessibility.getFullAXTree`), each row whose
`is_active` is true is a `checkbox` node, checked, named by the field's
label: "Active" under en (HotCRM declares `label: 'Active'`), the
translated column label under another locale. None has an empty name,
and no name carries "Yes", "No", "true" or "false". Rows whose
`is_active` is false still draw the destructive "Active — Off" badge,
unchanged, and no checkbox. Any other boolean column outside the
completion and status names reads the same way: one named checkbox per
row.
## Acceptance notes
- Observation, not filed (read from source, not reproduced in a
browser): the data-table cell wrapper sets `title` to
`String(cellValue)` for any non-object value, so hovering a boolean cell
shows a raw `true` / `false` tooltip, in English under every locale. It
does not name the checkbox: a `title` on an ancestor `div` is not part
of the checkbox's name. Carrier: none.
Session: `https://claude.ai/code/session_01JZnppgHRp4sREcouhkQYDB`
---
_Generated by [Claude
Code](https://claude.ai/code/session_01JZnppgHRp4sREcouhkQYDB)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent f5eec63 commit 7d0c174
3 files changed
Lines changed: 140 additions & 2 deletions
File tree
- .changeset
- packages/fields/src
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
985 | 985 | | |
986 | 986 | | |
987 | 987 | | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
988 | 996 | | |
989 | 997 | | |
990 | 998 | | |
| |||
1004 | 1012 | | |
1005 | 1013 | | |
1006 | 1014 | | |
1007 | | - | |
| 1015 | + | |
1008 | 1016 | | |
1009 | 1017 | | |
1010 | 1018 | | |
1011 | 1019 | | |
1012 | 1020 | | |
1013 | 1021 | | |
1014 | | - | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
1015 | 1027 | | |
1016 | 1028 | | |
1017 | 1029 | | |
| |||
0 commit comments