Skip to content

bug(material/checkbox): when both checked and indeterminate Inputs are true, checkbox displays indeterminate state but a11y tree has state of "checked" #26709

Closed
@zarend

Description

@zarend

Is this a regression?

The previous version in which this bug was not present was

No response

Description

In one specific edge case, mat-checkbox doesn't align with native checkbox. That's when checked and indeterminate are both set to true. On native checkbox, if indeterminate is true, then it renders indeterminate state (regardless of checked property). It also produced a sate of "mixed" in the a11y tree.

mat-checkbox handles it differently, since it only renders indeterminate state if the checked Input is false.

<mat-checkbox [checked]="true" [indeterminate]="true" />

Reproduction

Steps to reproduce:

  1. Create checkbox with code <mat-checkbox [checked]="true" [indeterminate]="true" />
  2. Inspect a11y tree

Expected Behavior

a11y tree has state of "mixed". This is what native checkbox does when the checked and indeterminate property (not attribute) are both set to true. Also, the aria state should match the visual state.

Actual Behavior

Checkbox visually displays the indeterminate state, but a11y tree has state of "selected".

Environment

  • Angular:
  • CDK/Material:
  • Browser(s):
  • Operating System (e.g. Windows, macOS, Ubuntu):

Metadata

Metadata

Assignees

Labels

AccessibilityThis issue is related to accessibility (a11y)P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/checkbox

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions