Skip to content

Commit

Permalink
fix(Indeterminate Checkbox): Improved accessibility for `Indeterminat…
Browse files Browse the repository at this point in the history
…e status (#1231) (#1428)
  • Loading branch information
olehnoskov-cengage authored and chris-cedrone-cengage committed Sep 19, 2024
1 parent 950c269 commit 096e923
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/a11y-intermediateCheckbox.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'react-magma-dom': patch
---

fix(Indeterminate Checkbox): Improved accessibility for `Indeterminate` status
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import * as React from 'react';
import { ThemeContext } from '../../theme/ThemeContext';
import {
CheckboxProps,
HiddenLabelText,
HiddenInput,
HiddenLabelText,
StyledFakeInput,
} from '../Checkbox';
import {
Expand All @@ -15,7 +15,7 @@ import { FormGroupContext } from '../FormGroup';
import { InputMessage } from '../Input/InputMessage';
import { StyledLabel } from '../SelectionControls/StyledLabel';
import { StyledContainer } from '../SelectionControls/StyledContainer';
import { useGenerateId, Omit } from '../../utils';
import { Omit, useGenerateId } from '../../utils';
import { VisuallyHidden } from '../VisuallyHidden';
import { Announce } from '../Announce';
import { I18nContext } from '../../i18n';
Expand Down Expand Up @@ -143,11 +143,14 @@ export const IndeterminateCheckbox = React.forwardRef<

const isInverse = useIsInverse(props.isInverse);

const ariaCheckedValue = isIndeterminate ? 'mixed' : !isUnchecked;

return (
<>
<StyledContainer style={containerStyle}>
<HiddenInput
{...other}
aria-checked={ariaCheckedValue}
aria-describedby={describedBy}
checked={isChecked}
data-testid={testId}
Expand Down

0 comments on commit 096e923

Please sign in to comment.