From 8f7c7cf482e832d8d59c43fb98316512656cde19 Mon Sep 17 00:00:00 2001 From: tinayuangao Date: Mon, 4 Dec 2017 11:11:41 -0800 Subject: [PATCH] fix(list): fix role for list-item (#8767) --- src/demo-app/a11y/list/list-a11y.html | 12 ++++++------ src/lib/list/list.spec.ts | 4 ++-- src/lib/list/list.ts | 1 - .../list-overview/list-overview-example.html | 6 +++--- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/demo-app/a11y/list/list-a11y.html b/src/demo-app/a11y/list/list-a11y.html index 70eea8b8410b..c5c45664a2df 100644 --- a/src/demo-app/a11y/list/list-a11y.html +++ b/src/demo-app/a11y/list/list-a11y.html @@ -3,7 +3,7 @@

Seasoning

Showing a non-interactive list of seasonings.

- {{item}} + {{item}} @@ -26,7 +26,7 @@

Messages

message subject, and content of the message.

- +

{{message.from}}

{{message.subject}}

@@ -39,8 +39,8 @@

{{message.from}}

Seasoning

Showing a non-interactive list of seasonings with dense style.

- - {{item}} + + {{item}}
@@ -49,14 +49,14 @@

Folders and notes for mailbox

Showing a list with two sections, "folders" and "notes".

Folders

- + folder

{{folder.name}}

{{folder.updated}}

Notes

- + note

{{note.name}}

{{note.updated}}

diff --git a/src/lib/list/list.spec.ts b/src/lib/list/list.spec.ts index b7644f7e247c..b76d5fa17e0d 100644 --- a/src/lib/list/list.spec.ts +++ b/src/lib/list/list.spec.ts @@ -115,8 +115,8 @@ describe('MatList', () => { let list = fixture.debugElement.children[0]; let listItem = fixture.debugElement.children[0].query(By.css('mat-list-item')); - expect(list.nativeElement.getAttribute('role')).toBeNull(); - expect(listItem.nativeElement.getAttribute('role')).toBe('listitem'); + expect(list.nativeElement.getAttribute('role')).toBeNull('Expect mat-list no role'); + expect(listItem.nativeElement.getAttribute('role')).toBeNull('Expect mat-list-item no role'); }); it('should not show ripples for non-nav lists', () => { diff --git a/src/lib/list/list.ts b/src/lib/list/list.ts index ab278121609d..621ab78cced6 100644 --- a/src/lib/list/list.ts +++ b/src/lib/list/list.ts @@ -119,7 +119,6 @@ export class MatListSubheaderCssMatStyler {} selector: 'mat-list-item, a[mat-list-item]', exportAs: 'matListItem', host: { - 'role': 'listitem', 'class': 'mat-list-item', '(focus)': '_handleFocus()', '(blur)': '_handleBlur()', diff --git a/src/material-examples/list-overview/list-overview-example.html b/src/material-examples/list-overview/list-overview-example.html index 9c416b76f0d3..c177f8712906 100644 --- a/src/material-examples/list-overview/list-overview-example.html +++ b/src/material-examples/list-overview/list-overview-example.html @@ -1,5 +1,5 @@ - Item 1 - Item 2 - Item 3 + Item 1 + Item 2 + Item 3