Skip to content

Commit 8728ed7

Browse files
committed
fix(list): fix role for list-item
1 parent 537b8b5 commit 8728ed7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/lib/list/list.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export class MatListSubheaderCssMatStyler {}
119119
selector: 'mat-list-item, a[mat-list-item]',
120120
exportAs: 'matListItem',
121121
host: {
122-
'role': 'listitem',
122+
'[attr.role]': 'role',
123123
'class': 'mat-list-item',
124124
'(focus)': '_handleFocus()',
125125
'(blur)': '_handleBlur()',
@@ -134,6 +134,7 @@ export class MatListItem extends _MatListItemMixinBase implements AfterContentIn
134134
CanDisableRipple {
135135
private _lineSetter: MatLineSetter;
136136
private _isNavList: boolean = false;
137+
role: string | null = null;
137138

138139
@ContentChildren(MatLine) _lines: QueryList<MatLine>;
139140

@@ -150,6 +151,7 @@ export class MatListItem extends _MatListItemMixinBase implements AfterContentIn
150151
@Optional() private _navList: MatNavList) {
151152
super();
152153
this._isNavList = !!_navList;
154+
this.role = this._isNavList ? null : 'listitem';
153155
}
154156

155157
ngAfterContentInit() {

0 commit comments

Comments
 (0)