Mantine radio and checkbox groups are labelled by the field's title id
Detect
- In your tests or CSS,
#root-labelor alabelelement selector for a@rjsf/mantineRadioWidgetorCheckboxesWidget. - In your
uiSchema, anaria-labelinui:optionsof a Mantine radio or checkbox group.
Change
The checkbox and radio groups pointed aria-labelledby at a Mantine label that was never rendered (#5332). Both are now labelled by the field's title id:
RadioWidget's label has the field's title id (root__title) instead of the id Mantine generated for it (root-label).CheckboxesWidget's label keeps that id, butCheckbox.Groupnow renders it, as a<div class="mantine-CheckboxGroup-label">inside the group's wrapper. It used to be a<label>before the group, and the group had no accessible name.- When the label is hidden (
ui:label: false) or left out ofinputWrapperOrder, it is still rendered with that id,hidden, so the group keeps its name. - When the field has no label, a
RadioWidget's group is named by a hidden title holding its fallback name, and aCheckboxesWidget's has noaria-labelledby. - An
aria-labelinui:optionsnames either group the same way, over a hidden label, and no longer lands on Mantine's wrapper. A label on screen still names the group.
Select the label by #root__title, or better, the group by its accessible name:
-container.querySelector('#root-label');
+screen.getByRole('radiogroup', { name: 'My field' });
Verify
getByRole('radiogroup', { name })finds a radio field, andgetByRole('group', { name })a checkboxes field.- A field with
ui:label: falsestill has a group with a name.
Also read: