[Checkbox] Fix checkbox a11y - screen readers doesn't announce undefined 'checked' (#2699)
* make checkbox a11y annouce null/undefined state * Change files * fix small spelling typo
This commit is contained in:
Родитель
c15156c8f2
Коммит
d09bb7f2f4
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "patch",
|
||||
"comment": "make checkbox a11y annouce null/undefined state",
|
||||
"packageName": "@fluentui-react-native/checkbox",
|
||||
"email": "rohanpd.work@gmail.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -107,6 +107,7 @@ export const useCheckbox = (props: CheckboxProps): CheckboxInfo => {
|
|||
|
||||
const getAccessibilityState = memoize(getAccessibilityStateWorker);
|
||||
function getAccessibilityStateWorker(disabled: boolean, checked: boolean, required: boolean, accessibilityState?: AccessibilityState) {
|
||||
checked = checked ?? false; // Make the value of checked as false when checked is undefined or null for screen reader to announce 'unchecked'
|
||||
if (accessibilityState) {
|
||||
return { disabled, checked, required, ...accessibilityState };
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче