-
Notifications
You must be signed in to change notification settings - Fork 587
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
[Accessibility][Autocomplete] Announce "no selectable options" #5662
Conversation
🦋 Changeset detectedLatest commit: 632d2c8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks! |
size-limit report 📦
|
@@ -381,9 +382,9 @@ function AutocompleteMenu<T extends AutocompleteItemProps>(props: AutocompleteMe | |||
</ActionList> | |||
) : emptyStateText !== false && emptyStateText !== null ? ( | |||
enabled ? ( | |||
<Box className={classes.EmptyStateWrapper}>{emptyStateText}</Box> | |||
<Announce className={classes.EmptyStateWrapper}>{emptyStateText}</Announce> |
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.
Need to use LiveRegion
or Debounce
because this does not provide feedback if a user continues to type.
debounceAnnouncement(emptyStateText as string) | ||
} | ||
}, [allItemsToRender]) | ||
|
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.
Why not Announce
I chose not to use the Announce
component because it does not re-render (aka re-announce) if TextContent does not change.
Why does this matter?
Imagine my autocomplete contains
Banana
, Apple
, Pear
if a user types aa
, no selectable options
should be announced. Then if a user types another a
making the input read aaa
, no selectable options
should be announced again.
If a user types bb
, no selectable options
should be announced. Then if the user presses CMD + A
to highlight all text and then CMD + C
to paste new text input we should hear no selectable options
announced.
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.
Why Debounce
I had to pair this functionality with debounce so that when a user types rapidly, we do not hear too much feedback
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.
Seems ok to me!
Closes #
Closes: https://github.com/github/accessibility-audits/issues/10123
Use the
Announce
component to announce "no selectable options" when a user filters options and there are no results in the Autocomplete component.Changelog
New
Changed
Removed
Rollout strategy
Testing & Reviewing
Merge checklist