-
Notifications
You must be signed in to change notification settings - Fork 1k
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 useTagGroup set aria-live to 'polite' for better screen reader support #6340
base: main
Are you sure you want to change the base?
Conversation
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.
I'm not sure I understand the comparison between the APG example and our implementation. The aria-live region in the APG example is for the "last change to tags" hidden region, whereas ours is the tag group itself. So I think they are a little different.
I think what you're suggesting is that aria-live
could be left as off
because it'll announce when it has focus anyways. If we set it to be polite
always, then it will always announce, regardless of if focus is in the group or not.
Apologies if I've misunderstood.
@snowystinger The APG example does use a visually-hidden span with In our current React Aria tagGroup, |
Thanks, I did some digging, and this particular line of code is 6+ years old. I'll see if anyone can remember why we have it. |
It looks like these commits might be related. |
I tend to be careful with leaving static |
Thanks @majornista for your expertise. So in summary, theoretically setting it to 'off' would be the way to go, and then we don't need to check if focus is within. I don't know how good the support is for that, however, @ryo-manba we can test it if you'd like to make the change. For components which are composite with a TagGroup in them, such as the APG example, users can follow the example as a blueprint. Our TagGroup's announcements won't happen while focus is in a textfield, so adding a live region which behaves how the APG example does would not conflict. |
Thank you, @majornista for highlighting the caution needed with static However, the TagGroup documentation notes:
So, if we're considering adapting the announcement behavior, I believe we should test the approach I suggested. |
The current
useTagGroup
implementation hasaria-live
set tooff
, which means updates aren't announced when an input element is outside the grid, as seen in the APG example.According to the specification, even if
aria-live
is set to'off'
, screen readers will read the updates if the region is focused.Therefore, setting
aria-live: 'polite'
only when focused seems unnecessary.✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Project: