Skip to content

fix(components): announce element:text_input's description with the field - #5770

Merged
os-zhuang merged 1 commit into
mainfrom
claude/issue-5735-description-aria-describedby
Aug 23, 2026
Merged

fix(components): announce element:text_input's description with the field#5770
os-zhuang merged 1 commit into
mainfrom
claude/issue-5735-description-aria-describedby

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

Fixes#5735

element:text_input rendered its resolved description as a bare sibling paragraph: no id on the paragraph, no aria-describedby on the Input. The two elements had no programmatic relationship, so a screen reader moving to the field announced the label and the value and never the helper text.

The three facts the card rests on — verified on this worktree, not taken from the card

ClaimVerdict
text-input.tsx renders the description with no id, and the Input gets no aria-describedbyHolds.{description && ...} rendered a text-sm text-muted-foreground paragraph; the Input prop list carried id / type / placeholder / value / defaultValue / required / disabled / onChange and no aria attribute.
The label half is wired: Label htmlFor={schema?.id} against Input id={schema?.id}Holds, and is now pinned by a test so it cannot regress behind this change.
packages/components/src/ui/input.tsx adds no aria attributes of its ownHolds — and it needs no change. It is a forwardRef over a native input that spreads ...props, so an aria-describedby handed down by a caller reaches the element unaltered. The primitive is named by triage as the thing that does not supply the attribute, and that stays true: it is not the thing that should. No edit to that file, as instructed.

The mechanism, and why it is the platform's rather than a local invention

renderers/form/form.tsx has wired this correctly all along, via ui/form.tsx: FormItem mints an id with React.useId(), useFormField derives formDescriptionId from it, FormDescription publishes that id, and FormControl (a Radix Slot) injects aria-describedby into the control. So one authoring key behaved two ways depending on which container the author reached for.

This change converges on the id source and the suffix derivation, not on the injection plumbing — there is no Slot here and no context to hang one on, and adding either to a nine-line render body would be the locally clever fix, not the converged one. The paragraph id is minted with React.useId() and the attribute is set directly.

It deliberately does not converge on one property of the form path: FormControl emits aria-describedby unconditionally, so a form field with no description publishes a reference to an element that was never rendered. This renderer emits the attribute only when a paragraph is actually rendered. (That divergence is stated here rather than filed — the form path's version is a Slot-level behaviour shared with FormMessage, and untangling it is a different card.)

The absent-schema.id path — the decision the card asked for

The card framed this as a choice between "generate a fallback id so the association always holds" and "stay consistent with label and wire only when the author gave the node an id", warning that the block should not end up with two conventions.

The two are not the same situation, and that is what decides it: the two associations need ids on opposite ends.

  • htmlFor must name the input, whose id is the author's schema.id — the same key usePageVariableBinding binds on. Only the author can supply it, so that wiring can only hold when they did. Unchanged.
  • aria-describedby must name the paragraph, an element this renderer wholly owns and that no author ever addresses. Nothing about it depends on the node carrying an id.

So there is one convention — associate where we can — applied to a case where we always can. Deriving the paragraph id from schema.id would have imported the label's dependency for no gain and added a failure the label wiring cannot have: two nodes sharing an authored id would publish two paragraphs sharing an id, and both fields' aria-describedby would resolve to whichever came first in the document. That is the wrong helper text announced, which is worse than none. A per-instance useId cannot collide, and there is a test for exactly that case.

Measured id shape under React 19.2.8: _r_1_-description.

The published prose, and the trailing clause

#5717 rewrote this key's ComponentInput.description to document the gap. That sentence is now false, so it is rewritten in the same change. A repo-wide search found exactly one copy of it (controlled against a neighbouring "Presentational only" occurrence in AiUsageIndicator.tsx, which the same search did return, so the single hit is a reading and not a broken instrument). The published skills corpus does not document this key at all — grep for text_input, record_picker and aria-describedby under skills/ returns zero, controlled against "ObjectUI", which returns three files. No diff under skills/, so the published-skills line-count ruling does not apply here.

The trailing clause — "instructions a user must not miss belong in label" — is kept, not deleted, and its basis is restated.

It was originally true because the text was not exposed at all. That reason is now gone. The reason it is still true is different and weaker: a description is announced after the accessible name (it is the last element of the name/role/state/value/description order), and screen readers expose description text through verbosity settings the user can turn down — NVDA's Report object descriptions under Object Presentation, VoiceOver's hint verbosity, JAWS' verbosity levels. So it remains the half of the announcement most likely to go unheard.

This half is cited, not measured, and the code says so. The tests here run dom-accessibility-api over happy-dom: that can prove the description is computed and that the reference resolves, and it cannot prove what any screen reader speaks in any given verbosity mode. Deleting the clause would have told authors that a critical instruction placed in description is now guaranteed to be heard, which nothing in this repo can support.

Tests — the relationship, not its halves

packages/components/src/__tests__/text-input-description-association.test.tsx, 9 cases. Every one resolves the link the way assistive tech does (read aria-describedby, look each id up in the document, compare the resolved element's text) through a helper that throws on a dangling id rather than skipping it. Asserting the two attributes separately would pass on a build where they point at different things.

Alongside the primary case: the two absence controls (no description, and a description resolving to an empty string, both emitting no attribute), the label association it shares an id with, the absent-schema.id path, the duplicate-authored-id case, description-beats-placeholder, the resolved-locale-value case, and one run through SchemaRenderer so the real render path is covered too.

Ablation — both directions, committed first, restored under a trap

Tests resolve source, not dist: vitest.config.mts:264 aliases @object-ui/components to packages/components/src, and no dist/ exists anywhere in this worktree (test -d packages/components/dist exits 1; so does packages/core/dist) while all 9 cases pass. No rebuild leg is possible or needed — there is no build artifact a stale copy could hide in.

Each mutation was confirmed on disk by anchored counts in both directions before any run, and restored by trap '...' EXIT INT TERM.

A — remove aria-describedby={descriptionId} from the Input. Injected-text count 0, paragraph-id count still 1, git diff --stat 1 deletion.

Tests 7 failed | 2 passed (9)

The 2 survivors are the two absence controls, and they survive correctly: they assert the attribute is absent, which removing the attribute cannot break. That is the point of having them — they are the half that mutation A structurally cannot reach.

B — drop the conditional, so the id (and therefore the attribute) is always emitted. Conditional form gone (0), unconditional form landed (1).

Tests 2 failed | 7 passed (9)
expect(element).not.toHaveAttribute("aria-describedby")
Received: aria-describedby="_r_1_-description"

Exactly the complement: the two absence controls, and only those, go red. Between them the two ablations account for all 9 cases, and neither leaves a case that no mutation can kill. Both restore legs confirmed on disk (anchored count back to 1; git status clean, i.e. byte-identical to the commit).

Verification — all at f448261f7, on a clean tree

RunResult
pnpm exec vitest run packages/components --maxWorkers=4184 files, 1663 tests, all passed, exit 0 (3m46s). Includes both snapshot suites.
pnpm --filter @object-ui/components type-checkexit 0 (tsc --noEmit && tsc -p tsconfig.test.json, both echoed) after pnpm --workspace-concurrency=2 --filter '@object-ui/components^...' build
pnpm lint (turbo run lint, the whole repo)47 successful, 47 total, exit 0. Not narrowed — the full task graph ran (4m00s). My two files carry only pre-existing-idiom no-explicit-any warnings, 0 errors repo-wide.
check:control-bytescheck-control-bytes: OK (scanned 4810 tracked text file(s); skipped 85 binary)
check:doc-typesEvery documented component type is registered.
check:self-importNo package names itself inside its own src/.
check:phantom-depsEvery in-scope import is declared by the package that publishes it.
check:spec-symbolsspec alignment claims: 2 declared deliberate copies, 18 unbacked claims in 5 packages. (exit 0)
check:skills-pathsOK (93/94 stated path(s) resolve across 18 guide file(s); 1 baselined)
check:i18n-keys / check:i18n-driftexit 0, both verdict lines clean
check:i18n-dead-keysexit 0 — and it prints that it is a report, not a gate

Every exit code above was captured before any pipe (cmd > file 2>&1; EXIT=$?), and each row quotes the gate's own verdict line rather than a bare $?.

Changeset: .changeset/text-input-description-aria-describedby-5735.md (@object-ui/components: patch).

Out-of-scope finding — reported, not widened

Swept per the card's ask. Within this renderer nothing else is in the same position: required reaches the native required attribute (announced), the asterisk is CSS generated content on the Label (invisible to happy-dom, part of the accessible name in a real browser, and not depended on either way by any test here), placeholder reaches the native attribute, and this renderer emits no error message at all, so there is no error relationship to wire.

One sibling block is, and it is filed rather than fixed: element:record_picker renders a label element with nohtmlFor while its SelectTrigger carries no id — so its label is unassociated in both directions, which is a step worse than the gap this card closes. Its own registration prose advertises the caption as rendered "in a label element". This is the same defect class #3341 ruled on and fixed for the ActionParamDialog select branch, one surface over.


Generated by Claude Code

…he field (#5735)
The resolved `description` rendered as a bare sibling paragraph: no `id` on the
paragraph, no `aria-describedby` on the `Input`, so the two had no programmatic
relationship and a screen reader moving to the field announced the label and the
value and never the helper text. The `label` half of the same block was already
wired, and the identical key authored inside `renderers/form/form.tsx` has been
announced all along — one authoring key, two behaviours, decided by container.
The paragraph id is minted per instance with `React.useId()` (the source
`FormItem` already mints the form renderer's description id from), not derived
from `schema.id`: `htmlFor` needs an id on the INPUT, which only the author can
supply, while `aria-describedby` needs one on the PARAGRAPH, which the renderer
owns. So the description association holds whether or not the node carries an
`id`, and cannot collide when two nodes share one. The attribute is emitted only
when a paragraph is actually rendered, never as a dangling reference.
The key's published `ComponentInput` description documented the gap; it is
rewritten here. Its "prefer `label` for instructions a user must not miss"
advice is kept on a new, cited basis — announcement order and AT verbosity —
rather than on the text being unreachable.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EuPCi56cnGyykygi3z9w4m
@github-actions

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

MetricValueBudget
Eager closure (gzip, 52 chunks)3918.4 KB3990.2 KB
Main entry chunk (gzip)152.5 KB350 KB
Entry fileindex-BV_lait0.js
StatusPASS

The eager closure is every chunk the entry reaches through static imports — what the browser fetches and parses before the app renders. The entry chunk on its own is a small fraction of it.


📦 Bundle Size Report

PackageSizeGzipped
app-shell (consoleActionDispatch.js)0.20KB0.19KB
app-shell (index.js)10.04KB3.72KB
app-shell (runtime-config.js)12.80KB4.47KB
app-shell (types.js)0.01KB0.04KB
app-shell (urlParams.js)10.06KB3.86KB
auth (ActiveOrganizationStorage.js)22.94KB8.44KB
auth (AuthContext.js)0.31KB0.24KB
auth (AuthGuard.js)2.07KB1.00KB
auth (AuthProvider.js)33.99KB8.57KB
auth (AuthShell.js)3.49KB1.40KB
auth (ForgotPasswordForm.js)12.21KB3.45KB
auth (LoginForm.js)18.15KB5.39KB
auth (PreviewBanner.js)0.90KB0.50KB
auth (RegisterForm.js)6.65KB2.22KB
auth (SocialSignInButtons.js)9.61KB3.89KB
auth (UserMenu.js)3.41KB1.23KB
auth (auth-gate-events.js)1.29KB0.66KB
auth (authStyles.js)5.04KB1.72KB
auth (createAuthClient.js)40.21KB10.80KB
auth (createAuthenticatedFetch.js)8.46KB3.43KB
auth (index.js)3.19KB1.44KB
auth (invitation-status.js)1.22KB0.70KB
auth (org-roles.js)6.66KB2.78KB
auth (phone-identifier.js)1.11KB0.66KB
auth (types.js)0.59KB0.35KB
auth (useAuth.js)5.30KB1.02KB
auth (useWorkspaceAdminStatus.js)5.13KB2.35KB
collaboration (CommentThread.js)26.08KB7.56KB
collaboration (LiveCursors.js)3.17KB1.27KB
collaboration (PresenceAvatars.js)6.49KB2.64KB
collaboration (PresenceProvider.js)2.79KB1.13KB
collaboration (index.js)1.68KB0.73KB
collaboration (useCollaborationTranslation.js)6.05KB2.52KB
collaboration (useCommentSearch.js)1.98KB0.88KB
collaboration (useConflictResolution.js)7.75KB1.86KB
collaboration (useMentionNotifications.js)1.81KB0.68KB
collaboration (usePresence.js)6.33KB1.84KB
collaboration (useRealtimeSubscription.js)7.91KB2.01KB
components (index.js)511.23KB115.03KB
core (index.js)4.92KB1.97KB
create-plugin (index.js)10.08KB3.26KB
data-objectstack (index.js)164.55KB45.67KB
fields (index.js)238.40KB59.89KB
i18n (LocalizationContext.js)1.76KB0.96KB
i18n (currency.js)1.22KB0.64KB
i18n (i18n.js)4.28KB1.75KB
i18n (index.js)3.44KB1.39KB
i18n (pickLocalized.js)7.62KB3.26KB
i18n (provider.js)23.13KB7.63KB
i18n (useDisplayLocale.js)2.85KB1.45KB
i18n (useObjectLabel.js)33.40KB8.71KB
i18n (useSafeTranslation.js)7.77KB3.13KB
layout (index.js)38.95KB10.97KB
mobile (MobileProvider.js)0.92KB0.49KB
mobile (ResponsiveContainer.js)0.94KB0.38KB
mobile (breakpoints.js)1.51KB0.70KB
mobile (createOfflineDataSource.js)5.61KB1.75KB
mobile (index.js)1.55KB0.62KB
mobile (offlineQueue.js)3.91KB1.35KB
mobile (pwa.js)0.97KB0.49KB
mobile (serviceWorker.js)1.48KB0.62KB
mobile (serviceWorkerSource.js)3.41KB1.48KB
mobile (useBreakpoint.js)1.54KB0.65KB
mobile (useGesture.js)6.96KB1.98KB
mobile (useOfflineSync.js)1.99KB0.72KB
mobile (usePullToRefresh.js)2.53KB0.85KB
mobile (useResponsive.js)0.72KB0.42KB
mobile (useResponsiveConfig.js)1.37KB0.63KB
mobile (useSpecGesture.js)4.32KB1.64KB
mobile (useTouchTarget.js)1.01KB0.54KB
permissions (MePermissionsProvider.js)9.53KB3.38KB
permissions (PermissionContext.js)0.31KB0.25KB
permissions (PermissionGuard.js)0.89KB0.45KB
permissions (PermissionProvider.js)4.64KB1.50KB
permissions (evaluator.js)5.12KB1.74KB
permissions (index.js)0.93KB0.41KB
permissions (store.js)0.91KB0.42KB
permissions (useFieldPermissions.js)1.28KB0.53KB
permissions (usePermissions.js)1.93KB0.88KB
plugin-ai (index.js)15.75KB3.80KB
plugin-calendar (index.js)46.62KB12.83KB
plugin-charts (index.js)64.65KB18.32KB
plugin-chatbot (index.js)181.41KB43.22KB
plugin-dashboard (index.js)128.41KB32.95KB
plugin-designer (index.js)212.30KB42.80KB
plugin-detail (index.js)242.34KB60.98KB
plugin-editor (index.js)2.46KB1.10KB
plugin-form (index.js)125.63KB30.64KB
plugin-gantt (index.js)164.10KB39.87KB
plugin-grid (index.js)200.79KB54.26KB
plugin-kanban (index.js)52.93KB14.60KB
plugin-list (index.js)111.80KB27.20KB
plugin-map (index.js)20.06KB6.62KB
plugin-markdown (index.js)13.72KB4.69KB
plugin-report (index.js)43.49KB11.93KB
plugin-timeline (index.js)26.68KB7.66KB
plugin-tree (index.js)8.50KB2.88KB
plugin-view (index.js)84.61KB20.74KB
providers (DataSourceProvider.js)0.75KB0.39KB
providers (MetadataProvider.js)1.37KB0.59KB
providers (ThemeProvider.js)1.90KB0.85KB
providers (UploadProvider.js)11.66KB3.50KB
providers (index.js)0.45KB0.23KB
providers (types.js)0.01KB0.04KB
react-runtime (index.js)5.62KB2.34KB
react (LazyPluginLoader.js)3.77KB1.33KB
react (SchemaRenderer.js)44.39KB14.99KB
react (data-invalidation.js)5.05KB2.08KB
react (index.js)1.33KB0.69KB
react (schema-input.js)2.32KB1.24KB
react (spec-input.js)0.20KB0.18KB
sdui-parser (codegen.js)5.41KB2.34KB
sdui-parser (index.js)4.77KB2.16KB
sdui-parser (input-type.js)2.84KB1.40KB
sdui-parser (parse.js)12.13KB3.65KB
sdui-parser (provenance.js)3.66KB1.82KB
sdui-parser (types.js)0.28KB0.23KB
sdui-parser (validate.js)6.92KB2.40KB
types (ai.js)0.20KB0.17KB
types (api-types.js)0.20KB0.18KB
types (app.js)2.87KB0.99KB
types (base.js)0.20KB0.18KB
types (blocks.js)0.20KB0.18KB
types (complex.js)0.20KB0.18KB
types (crud.js)0.20KB0.18KB
types (dashboard-filter-alias.js)6.23KB2.74KB
types (data-display.js)0.20KB0.18KB
types (data-protocol.js)0.20KB0.19KB
types (data.js)0.20KB0.18KB
types (designer.js)1.87KB0.85KB
types (disclosure.js)0.20KB0.18KB
types (error-code.js)1.54KB0.88KB
types (feedback.js)0.20KB0.18KB
types (field-types.js)0.20KB0.18KB
types (form.js)0.20KB0.18KB
types (http-inflight.js)8.87KB3.73KB
types (http-retry.js)4.32KB2.02KB
types (index.js)3.88KB1.85KB
types (layout.js)0.20KB0.18KB
types (managed-by.js)0.19KB0.18KB
types (mobile.js)2.59KB1.31KB
types (navigation.js)0.20KB0.18KB
types (objectql.js)0.20KB0.18KB
types (overlay.js)0.20KB0.18KB
types (permissions.js)0.20KB0.18KB
types (plugin-scope.js)0.20KB0.18KB
types (record-components.js)0.20KB0.19KB
types (record-semantics.js)1.28KB0.67KB
types (registry.js)0.20KB0.18KB
types (reports.js)0.20KB0.18KB
types (spec-report.js)5.05KB1.93KB
types (spec-ui-namespace.js)0.20KB0.19KB
types (system-fields.js)3.33KB1.54KB
types (theme.js)3.40KB1.68KB
types (ui-action.js)3.40KB1.71KB
types (views.js)0.20KB0.18KB
types (widget.js)0.20KB0.18KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

@os-zhuang
os-zhuang marked this pull request as ready for review August 23, 2026 06:29
@os-zhuang
os-zhuang added this pull request to the merge queueAug 23, 2026
Merged via the queue into main with commit 27308c5Aug 23, 2026
23 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-5735-description-aria-describedby branch August 23, 2026 06:29
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants

@os-zhuang@claude