Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Fix target id in searchfield label #23464

Merged
merged 8 commits into from
Sep 5, 2023
9 changes: 7 additions & 2 deletions code/ui/manager/src/components/sidebar/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,9 @@ export const Search = React.memo<{
}
}

const inputId = 'storybook-explorer-searchfield';
const inputProps = getInputProps({
id: 'storybook-explorer-searchfield',
id: inputId,
ref: inputRef,
required: true,
type: 'search',
Expand All @@ -361,9 +362,13 @@ export const Search = React.memo<{
onBlur: () => setPlaceholder('Find components'),
});

const labelProps = getLabelProps({
htmlFor: inputId,
});

return (
<>
<ScreenReaderLabel {...getLabelProps()}>Search for components</ScreenReaderLabel>
<ScreenReaderLabel {...labelProps}>Search for components</ScreenReaderLabel>
<SearchField
{...getRootProps({ refKey: '' }, { suppressRefError: true })}
className="search-field"
Expand Down