-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Try fixing combobox a11y issues #27431
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,7 +135,7 @@ function ComboboxControl( { | |
const onFocus = () => { | ||
setIsExpanded( true ); | ||
onFilterValueChange( '' ); | ||
setInputValue( '' ); | ||
// setInputValue( '' ); | ||
}; | ||
|
||
const onFocusOutside = () => { | ||
|
@@ -170,7 +170,7 @@ function ComboboxControl( { | |
) | ||
: __( 'No results.' ); | ||
|
||
speak( message, 'assertive' ); | ||
speak( message, 'polite' ); | ||
} | ||
}, [ matchingSuggestions, isExpanded ] ); | ||
|
||
|
@@ -203,6 +203,11 @@ function ComboboxControl( { | |
instanceId={ instanceId } | ||
ref={ inputContainer } | ||
value={ isExpanded ? inputValue : currentLabel } | ||
aria-label={ | ||
currentLabel | ||
? `${ currentLabel }, ${ label }` | ||
: null | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there any other default value that would be good here rather than null? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The purpose of |
||
} | ||
onFocus={ onFocus } | ||
isExpanded={ isExpanded } | ||
selectedSuggestionIndex={ matchingSuggestions.indexOf( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might as well just remove it instead of commenting out :) We've got git!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, that was unintended! I don't think removing it changes anything, but it's not needed for the fix so I'll revert the change.