fix(ui): add missing aria-label to SearchField components

Add aria-label attributes to SearchField components to fix
accessibility warnings from React Aria.

- Select: add aria-label to SearchField using searchPlaceholder
- MenuAutocomplete: add aria-label to RASearchField, remove
  redundant aria-label from RAInput
- MenuAutocompleteListbox: same as MenuAutocomplete

Per React Aria docs, aria-label should be on SearchField, not
the child Input.

Signed-off-by: Johan Persson <johanopersson@gmail.com>
This commit is contained in:
Johan Persson
2026-01-15 15:32:10 +01:00
parent fe7fe696ea
commit 4fb15d223e
3 changed files with 10 additions and 2 deletions
+7
View File
@@ -0,0 +1,7 @@
---
'@backstage/ui': patch
---
Added missing `aria-label` attributes to `SearchField` components in `Select`, `MenuAutocomplete`, and `MenuAutocompleteListbox` to fix accessibility warnings.
Affected components: Select, MenuAutocomplete, MenuAutocompleteListbox
+2 -2
View File
@@ -255,13 +255,13 @@ export const MenuAutocomplete = (props: MenuAutocompleteProps<object>) => {
classNames.searchField,
styles[classNames.searchField],
)}
aria-label={props.placeholder || 'Search'}
>
<RAInput
className={clsx(
classNames.searchFieldInput,
styles[classNames.searchFieldInput],
)}
aria-label="Search"
placeholder={props.placeholder || 'Search...'}
/>
<RAButton
@@ -334,13 +334,13 @@ export const MenuAutocompleteListbox = (
classNames.searchField,
styles[classNames.searchField],
)}
aria-label={props.placeholder || 'Search'}
>
<RAInput
className={clsx(
classNames.searchFieldInput,
styles[classNames.searchFieldInput],
)}
aria-label="Search"
placeholder={props.placeholder || 'Search...'}
/>
<RAButton
@@ -55,6 +55,7 @@ export function SelectContent({
classNames.searchWrapper,
styles[classNames.searchWrapper],
)}
aria-label={searchPlaceholder}
>
<Input
placeholder={searchPlaceholder}