Skip to content

fix(FormFieldSelect): point the label at the trigger and mark it invalid (#574) - #596

Merged
mathewtaylor merged 1 commit into
v4.2.0from
foreman/ravi/ml-281
Oct 5, 2026
Merged

mathewtaylor merged 1 commit into
v4.2.0from
foreman/ravi/ml-281

Conversation

@mathewtaylor

Copy link
Copy Markdown
Contributor

Part of #574, following #595 for FormFieldCombobox and FormFieldMultiSelect.

BbFormFieldSelect already gave its trigger the field's generated id, but:

  • its BbFieldLabel had no For, so the label wasn't tied to the trigger;
  • the trigger never got aria-invalid, whether from ErrorText or form validation.

Changes

  • BbFormFieldSelect: <BbFieldLabel For="@ControlId">, and the trigger gets aria-invalid="true" while the field is invalid. When it's valid the attribute is left off, not set to "false".
  • FormFieldSelectDemo: the Accessibility list now says what the component actually does.
  • FormFieldSelectTriggerTests (4 tests, same pattern as FormFieldTriggerTests in fix(FormFieldCombobox, FormFieldMultiSelect): point the label at the trigger and pass the invalid state (#574) #595): the label's for matches the trigger id, and aria-invalid/aria-describedby follow ErrorText, HelperText and form validation as it's set and cleared.

No public API change.

Testing

  • 3 of the 4 new tests fail without the fix (the HelperText case passed before and still passes).
  • Full suite: 1115 passed.
  • Demo project builds with no warnings.

…lid (#574)

BbFormFieldSelect already gave its trigger the field's generated id, but its BbFieldLabel had no for, so the label wasn't tied to the trigger, and the trigger never got aria-invalid from ErrorText or form validation. The label now points at the trigger, and the trigger carries aria-invalid="true" while the field is invalid (absent otherwise), matching BbFormFieldCombobox and BbFormFieldMultiSelect.
@mathewtaylor
mathewtaylor merged commit d79abb0 into v4.2.0 Oct 5, 2026
1 check passed
@mathewtaylor
mathewtaylor deleted the foreman/ravi/ml-281 branch October 5, 2026 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant