fix(a11y): wrong result count spoken when items change#1058
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1058 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 17 17
Lines 1319 1319
Branches 241 241
=========================================
Hits 1319 1319
Continue to review full report at Codecov.
|
|
Hi! I need a repro case / sandbox with the issue in order to move forward with this. |
Sorry @silviuaavram, I've added a reduced test case to the PR. |
|
I've also now added the |
|
Tracked the bug, it makes sense to have these changes. However I don't think we should update the status just because of the getter function being changed. It's not something that's user facing. I don't like not to put the exhaustive depends in the useEffect but for me it makes sense to update the a11y status only when state changes or the number of items change. So I would leave it with only the Please add some tests as well. Check if, on |
This would be fine, except for the fact it makes updating the If we truly only want the status to be updated on certain events, would it not be better to simply call it within the handlers for those events? Perhaps after the I'll add the tests cases for |
|
Closing this as it's fixed by #1076 |
What:
Added
itemsandgetA11yStatusMessageto theuseEffecthook insideuseSelectanduseComboboxthat updates thea11ystatus.Why:
Screen readers don't read the a11y status that should be read, as far as I can tell. This happens because the
itemCountandpreviousItemCountare always the same, due to the missing dependencies in theuseEffecthook, which means the right text is never returned.Reproducing:
Go to this sandbox link and open the console pane. Start typing into the input. You'll notice that it outputs what the screen reader would say, and that the item counts are actually wrong on each call, and that the
itemCountandpreviousItemCountare identical on every call.Checklist: