-
Notifications
You must be signed in to change notification settings - Fork 940
Description
downshiftversion: v6.0.16nodeversion: v14.15.4npm(oryarn) version: 6.14.10
Relevant code or config
a11y message functions overriden:
getA11ySelectionMessage: () => console.log('getA11ySelectionMessage'),
getA11yStatusMessage: () => console.log('getA11yStatusMessage'),
Both functions don't return any value because I just wanted to check if when it is called.
https://codesandbox.io/s/clever-dream-v6o6s?file=/src/hooks/useCombobox/basic-usage.js:413-557
What you did:
Select item anyhow.
Check console logs and notice that getA11ySelectionMessage entry is not available despite item is selected.
Problem description:
useCombobox calls useA11yMessageSetter function two times: first and second
There is updateA11yStatus called which is debounced.
After seleted item change there is getA11yStatusMessage fuction called immediately and returns empty string so item change announcement is blocked.
Suggested solution
Debounced updateA11yStatus can be separately debounced for getA11ySelectionMessage and getA11yStatusMessage.
Would you like me to propose a PR with solution?