angular/components

bug(mat-form-field): Form field removes aria-describedby attribute added by AriaDescriber

donghee-l opened this issue · 0 comments

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

Hello,

We have mat input inside the mat form field, and noticed that the input's aria-describedby attribute gets removed on focus or state change if the aria-describedby ids were added by AriaDescriber. When the input receives focus, _syncDescribedByIds is run, but it determines that the list of ids is empty, causing aria-describedby attribute to be removed from the input.

It seems that _syncDescribedByIds does not account for ids added by AriaDescriber, and solution may be an update to the _syncDescribedByIds logic.

Reproduction

StackBlitz link: https://stackblitz.com/edit/components-issue-starter-1gvgxn?file=src%2Fmain.ts
Steps to reproduce:

  1. Observe that has aria-describedby attribute.
  2. Focus on the by clicking on it.
  3. Observe that aria-describedby attribute is removed from .

Expected Behavior

aria-describedby attribute that were added via AriaDescriber should not be removed.

Actual Behavior

aria-describedby attribute that were added via AriaDescriber are removed.

Environment

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