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

fix(js): better accessibility for submit button label #1254

Merged
merged 1 commit into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ See: https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocom
class="aa-InputWrapperPrefix"
>
<label
arialabel="Submit"
class="aa-Label"
for="autocomplete-input"
id="autocomplete-label"
Expand Down
4 changes: 4 additions & 0 deletions packages/autocomplete-js/src/createAutocompleteDom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,13 @@ export function createAutocompleteDom<TItem extends BaseItem>({
title: translations.submitButtonTitle,
children: [SearchIcon({ environment })],
});
// @MAJOR Remove the label wrapper for the submit button.
// The submit button is sufficient for accessibility purposes, and
// wrapping it with the label actually makes it less accessible (see CR-6077).
const label = createDomElement('label', {
class: classNames.label,
children: [submitButton],
ariaLabel: translations.submitButtonTitle,
...labelProps,
});
const clearButton = createDomElement('button', {
Expand Down