Skip to content

NumberField never reads the published error slot, so an invalid number field is not announced (#3222 gap) #6803

Description

@claude

Found while implementing #6780 (PR #6801). Filed rather than folded in — it is
#3222's class, not #6780's.

What

NumberField never reads the published validation slot. It destructures
{ value, onChange, field, readonly, ...props } — no error — so the error
prop lands in props, and toDomProps (a whitelist) drops it. The widget
renders no aria-invalid of its own.

Consequence: when the form renderer marks a number field invalid, the
control is not announced as invalid to assistive tech by the widget itself
.

#3222 gave email, phone, url, textarea, currency, percent,
markdown and later select an aria-invalid={!!error} and pinned each of
them in packages/fields/src/__tests__/widget-aria-invalid-e2e.test.tsx.
NumberField is absent from that list and from that pin — so the gap is
invisible to the suite that exists precisely to catch it.

⚠️ Note for whoever picks this up

PR #6801 writes aria-invalid on NumberField only when its own bad-input
refusal is active
, deliberately spread conditionally rather than as
aria-invalid={!!refusal}. That is because the widget does NOT read error:
an unconditional attribute would stamp "false" over the correct value that
FormControl's Radix Slot hands down — the exact overwrite the #3222 e2e file
warns about in its header.

⇒ When error is wired up here, that conditional spread should become the
ordinary aria-invalid={!!error || !!refusal} the other three widgets use, and
number should be added to the #3222 e2e list. Doing one without the other
re-opens the overwrite.

Scope

Small: destructure error, OR it into the existing refusal computation, add
number to the WIDGETS table in widget-aria-invalid-e2e.test.tsx.


Generated by Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdomain:uiobjectui ui stream: fix lands on the published library or apps — objectui execution seatpm:blockedpriority:p1

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions