diff --git a/src/material/list/list-base.ts b/src/material/list/list-base.ts index 327d2ec3698c..f62d34ee806b 100644 --- a/src/material/list/list-base.ts +++ b/src/material/list/list-base.ts @@ -77,6 +77,7 @@ export abstract class MatListBase { host: { '[class.mdc-list-item--disabled]': 'disabled', '[attr.aria-disabled]': 'disabled', + '[attr.disabled]': '(_isButtonElement && disabled) || null', }, }) /** @docs-private */ @@ -98,6 +99,9 @@ export abstract class MatListItemBase implements AfterViewInit, OnDestroy, Rippl /** Host element for the list item. */ _hostElement: HTMLElement; + /** indicate whether the host element is a button or not */ + _isButtonElement: boolean; + /** Whether animations are disabled. */ _noopAnimations: boolean; @@ -177,6 +181,7 @@ export abstract class MatListItemBase implements AfterViewInit, OnDestroy, Rippl ) { this.rippleConfig = globalRippleOptions || {}; this._hostElement = this._elementRef.nativeElement; + this._isButtonElement = this._hostElement.nodeName.toLowerCase() === 'button'; this._noopAnimations = animationMode === 'NoopAnimations'; if (_listBase && !_listBase._isNonInteractive) { @@ -186,10 +191,7 @@ export abstract class MatListItemBase implements AfterViewInit, OnDestroy, Rippl // If no type attribute is specified for a host ` + `, +}) +class ActionListWithDisabledList extends BaseTestList { + disableList = true; +} + +@Component({ + template: ` + + + `, +}) +class ActionListWithDisabledItem extends BaseTestList { + @ViewChild(MatListItem) buttonItem: MatListItem; + disableItem = true; +} + @Component({ template: `