Skip to content
This repository was archived by the owner on Oct 26, 2026. It is now read-only.

Commit 98977bb

Browse files
committed
chore(changeset): note the Testing Library label-query effect of objectui#10368
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BP8CMtACxTdLjqR6rhd33C
1 parent 8d74457 commit 98977bb

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎.changeset/10368-required-marker-real-span.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44

55
fix(components): the required asterisk no longer enters a field's accessible name (objectui#10368)
66

7-
`FieldContainer`, `element:text_input` and the `input`, `textarea`, `checkbox` and `select` renderers drew the required asterisk as CSS generated content (an `::after` utility) on the field's label. Browsers include generated content when they compute an accessible name, so where that label is associated with its control, a required field labelled "Title" was named "Title*". A pseudo-element cannot carry `aria-hidden`.
7+
`FieldContainer`, `element:text_input` and the `input`, `textarea`, `checkbox` and `select` renderers drew the required asterisk as CSS generated content (an `::after` utility) on the field's label. The accessible-name computation includes generated content, so where that label is associated with its control, Chromium named a required field labelled "Title" as "Title*". A pseudo-element cannot carry `aria-hidden`.
88

99
The asterisk is now a real `span` with `aria-hidden="true"` and `data-required-marker`, the shape the form renderer's `FormLabel` already uses, so it stays out of the name. It keeps the same colour and spacing. Every control keeps the required state it had before: the native `required` attribute, or `aria-required`. Validation does not change.
1010

1111
The `select` renderer's label is not associated with its trigger, so its name never contained the asterisk; its marker changes shape only. The generated-content utility these labels used is no longer compiled into `style.css`.
12+
13+
For test suites that render these fields: Testing Library's exact-string `getByLabelText('Title')` matches the label's whole text, and that text now includes the hidden `*`, so it no longer finds a required field. `getByRole('textbox', { name: 'Title' })` does, because it computes the accessible name.

0 commit comments

Comments
 (0)