Skip to content

bug(MatAnchor): aria-disabled not applied with disabledInteractive #29923

Closed
@caleniuc

Description

@caleniuc

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

MAT_ANCHOR_HOST applies aria-disabled differently than MAT_BUTTON_HOST. On the anchor, aria-disabled is applied the same as disabled, so disabledInteractive has no effect on it.


MAT_BUTTON_HOST
MAT_ANCHOR_HOST

On MAT_ANCHOR_HOST both get set to _getDisabledAttribute

protected _getDisabledAttribute() {
return this.disabledInteractive || !this.disabled ? null : true;
}

Was expecting thataria-disabled is set like on MAT_BUTTON_HOST to _getAriaDisabled

protected _getAriaDisabled() {
if (this.ariaDisabled != null) {
return this.ariaDisabled;
}
return this.disabled && this.disabledInteractive ? true : null;
}

Follow up of #29882.

Reproduction

StackBlitz link: https://stackblitz.com/edit/soecj6-6ca7ni?file=src%2Fexample%2Fbutton-overview-example.html
Steps to reproduce:

  1. Have an anchor button with disabled and disabledInteractive set to true
  2. Notice aria-disabled is not applied

Expected Behavior

<a> button has aria-disabled applied when disabledInteractive is true, like on <button>

Actual Behavior

<a> button does not have aria-disabled applied when disabledInteractive is true

Environment

  • Angular: v18, v19.0.0-next.2
  • CDK/Material: v18, v19.0.0-next.2
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): macOS

Metadata

Metadata

Assignees

Labels

P2The issue is important to a large percentage of users, with a workaroundarea: material/button

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions