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 Sep 12, 2024
1 parent 02fde4e commit 9d840d8
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

2 comments on commit 9d840d8

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.