-
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
Conversation
Size Change: +429 B (0%) Total Size: 1.19 MB
ℹ️ View Unchanged
|
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.
Looks pretty good - but haven't tested locally yet. Left a question and a note inline.
@@ -135,7 +135,7 @@ function ComboboxControl( { | |||
const onFocus = () => { | |||
setIsExpanded( true ); | |||
onFilterValueChange( '' ); | |||
setInputValue( '' ); | |||
// setInputValue( '' ); |
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.
// setInputValue( '' ); |
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.
aria-label={ | ||
currentLabel | ||
? `${ currentLabel }, ${ label }` | ||
: null |
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.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose of null
here is to not render the aria-label
if there's no currently selected value, because in that case, its contents are identical to the already existing label, so we don't need to override it with aria-label
.
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.
LGTM, I don't have any knowledge of the aria-label
change though.
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.
Looks good and works well in testing 👍
I can confirm that this fix is perfect for Mac Voiceover. NVDA doesn't seem to handle this well as it reads the description first, the current selected item, Parent Page, and then something else after. I guess it is the current cursor position in the list. It's very odd, but I think it will just have to suffice until something better can be done. In general this searchable combo box is not the most accessible thing in the world, but I support this PR as it fixes a major issue on Mac. Thanks. |
* Fix label announcement on VoiceOver * Try to fix selection announcement * Revert commented line.
@wordpress/components: 11.1.2 -> 11.1.3 This fixes an accessibility regression with VoiceOver not announcing the input label or an existing selection in the parent page dropdown under "Page Attributes" in the sidebar. See WordPress/gutenberg#27431 for more details. Props isabel_brison, sarahricker, alexstine, kevin940726, talldanwp. Fixes #51923. git-svn-id: https://develop.svn.wordpress.org/trunk@49737 602fd350-edb4-49c9-b593-d223f7449a82
@wordpress/components: 11.1.2 -> 11.1.3 This fixes an accessibility regression with VoiceOver not announcing the input label or an existing selection in the parent page dropdown under "Page Attributes" in the sidebar. See WordPress/gutenberg#27431 for more details. Props isabel_brison, sarahricker, alexstine, kevin940726, talldanwp. Fixes #51923. git-svn-id: https://develop.svn.wordpress.org/trunk@49737 602fd350-edb4-49c9-b593-d223f7449a82
@wordpress/components: 11.1.2 -> 11.1.3 This fixes an accessibility regression with VoiceOver not announcing the input label or an existing selection in the parent page dropdown under "Page Attributes" in the sidebar. See WordPress/gutenberg#27431 for more details. Props isabel_brison, sarahricker, alexstine, kevin940726, talldanwp. Fixes #51923. Built from https://develop.svn.wordpress.org/trunk@49737 git-svn-id: http://core.svn.wordpress.org/trunk@49460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
@wordpress/components: 11.1.2 -> 11.1.3 This fixes an accessibility regression with VoiceOver not announcing the input label or an existing selection in the parent page dropdown under "Page Attributes" in the sidebar. See WordPress/gutenberg#27431 for more details. Props isabel_brison, sarahricker, alexstine, kevin940726, talldanwp. Reviewed by isabel_brison, SergeyBiryukov. Merges [49737] to the 5.6 branch. Fixes #51923. git-svn-id: https://develop.svn.wordpress.org/branches/5.6@49738 602fd350-edb4-49c9-b593-d223f7449a82
@wordpress/components: 11.1.2 -> 11.1.3 This fixes an accessibility regression with VoiceOver not announcing the input label or an existing selection in the parent page dropdown under "Page Attributes" in the sidebar. See WordPress/gutenberg#27431 for more details. Props isabel_brison, sarahricker, alexstine, kevin940726, talldanwp. Reviewed by isabel_brison, SergeyBiryukov. Merges [49737] to the 5.6 branch. Fixes #51923. Built from https://develop.svn.wordpress.org/branches/5.6@49738 git-svn-id: http://core.svn.wordpress.org/branches/5.6@49461 1a063a9b-81f0-0310-95a4-ce76da25c4cd
@wordpress/components: 11.1.2 -> 11.1.3 This fixes an accessibility regression with VoiceOver not announcing the input label or an existing selection in the parent page dropdown under "Page Attributes" in the sidebar. See WordPress/gutenberg#27431 for more details. Props isabel_brison, sarahricker, alexstine, kevin940726, talldanwp. Fixes #51923. Built from https://develop.svn.wordpress.org/trunk@49737 git-svn-id: https://core.svn.wordpress.org/trunk@49460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
@wordpress/components: 11.1.2 -> 11.1.3 This fixes an accessibility regression with VoiceOver not announcing the input label or an existing selection in the parent page dropdown under "Page Attributes" in the sidebar. See WordPress/gutenberg#27431 for more details. Props isabel_brison, sarahricker, alexstine, kevin940726, talldanwp. Reviewed by isabel_brison, SergeyBiryukov. Merges [49737] to the 5.6 branch. Fixes #51923. Built from https://develop.svn.wordpress.org/branches/5.6@49738 git-svn-id: https://core.svn.wordpress.org/branches/5.6@49461 1a063a9b-81f0-0310-95a4-ce76da25c4cd
@wordpress/components: 11.1.2 -> 11.1.3 This fixes an accessibility regression with VoiceOver not announcing the input label or an existing selection in the parent page dropdown under "Page Attributes" in the sidebar. See WordPress/gutenberg#27431 for more details. Props isabel_brison, sarahricker, alexstine, kevin940726, talldanwp. Reviewed by isabel_brison, SergeyBiryukov. Merges [49737] to the 5.6 branch. Fixes #51923. Built from https://develop.svn.wordpress.org/branches/5.6@49738 git-svn-id: http://core.svn.wordpress.org/branches/5.6@49461 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Description
Fixes #27385.
The issue with VoiceOver not announcing the input label is straightforward: changing the
aria-live
setting topolite
fixes it. (Thanks for the suggestion, @talldan 😄 )The selection not being announced is trickier as different screen readers announce input selection in different order. What I tried here was adding an
aria-label
with the selection value as well as the original label value (because the aria-label will override the label) and that reads out in VoiceOver in the same order as a nativeselect
would, but in NVDA it doesn't quite match.Would be good to have some a11y input into this.
How has this been tested?
Tested with VoiceOver/Safari on macOS and NVDA/Firefox on Windows 10.
Screenshots
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist: