Skip to content

bug(mat-option): aria-selected is always false when used inside multiselect mat-autocomplete #31431

Closed
@tHe-AK

Description

@tHe-AK

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

I tried creating mat-autocomplete with multiselect options along with a checkbox following a StackOverflow answer:
https://stackoverflow.com/a/50569422/8043493
The functionality works fine, but the aria-selected attribute for the selected option is false. I tried setting it explicitly using attr.aria-selected, but it is not working.

Reproduction

Image

StackBlitz link: https://stackblitz.com/edit/w8j5bi2o
Steps to reproduce:

  1. Select an option from the autocomplete.
  2. Navigate to the same option with a screen reader opened, OR check the aria-selected attribute value for the selected mat-option.

Expected Behavior

The selected mat-option should have aria-selected as true.

Actual Behavior

The selected mat-option has aria-selected as false.

Environment

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageThis issue needs to be triaged by the team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions