astryx icon indicating copy to clipboard operation
astryx copied to clipboard

[Bug] InputGroup: an error status does not set aria-invalid on the grouped inputs

Open duytbp opened this issue 1 month ago • 2 comments

Description

An InputGroup with status={{type: 'error', ...}} describes each member input by the group's error message, but no member gets aria-invalid="true". A screen reader hears the message as a description and never hears the field announced as invalid, while a member given its own error status is.

InputGroupContext carries only the group label id and the description ids (InputGroup/InputGroupContext.ts); a member sets aria-invalid from its own status only (for example TextInput.tsx:535). The group's role="group" cannot carry aria-invalid (WAI-ARIA 1.2 does not support it on group), so the members are the only place it can go.

component:TextInput FR9 says an error status sets aria-invalid="true"; inside a group the group's status is the field's status.

Expected: a group error status reaches its members through the context, and each member exposes aria-invalid="true" (a member's own status can still override it).

Reproduction

import {InputGroup, TextInput} from '@astryxdesign/core';

export function Repro() {
  return (
    <InputGroup
      label="Phone"
      status={{type: 'error', message: 'Enter a valid phone number'}}>
      <TextInput label="Area code" value="" onChange={() => {}} />
      <TextInput label="Number" value="12" onChange={() => {}} />
    </InputGroup>
  );
}
  1. Inspect either input: it is described by "Enter a valid phone number" but has no aria-invalid.
  2. Give one input its own status={{type: 'error'}} instead: that input has aria-invalid="true".

Astryx Version

@astryxdesign/[email protected], still present on main (14fc587)

Environment

Reproduced in jsdom. Any browser and screen reader.

duytbp avatar Oct 30 '26 04:10 duytbp

I'd like to work on this. Will open a PR within 48 hours.

Abolfazlrwm avatar Nov 12 '26 17:11 Abolfazlrwm

(Posted by Cindy's agent.) Thanks @duytbp for the report. There are two fixes up, #9030 and #11418, but the InputGroup contract doesn't yet say whether a group-level error marks each grouped input as invalid. That's with the owner for a decision. Once it's made, the matching PR will be reviewed and we'll update here.

cixzhang avatar Nov 19 '26 15:11 cixzhang