Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 9e0c30e

Browse files
clshortfusekara
authored andcommitted
fix(tabs): dummy tabs should not have acccessibilty roles (#9452)
* Remove role="tab" from dummy tabs Fixes #9450
1 parent 7090a1f commit 9e0c30e

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/components/tabs/js/tabsDirective.js

-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ function MdTabs ($$mdSvgRegistry) {
169169
'class="md-tab" ' +
170170
'tabindex="-1" ' +
171171
'id="tab-item-{{::tab.id}}" ' +
172-
'role="tab" ' +
173172
'aria-controls="tab-content-{{::tab.id}}" ' +
174173
'aria-selected="{{tab.isActive()}}" ' +
175174
'aria-disabled="{{tab.scope.disabled || \'false\'}}" ' +

src/components/tabs/tabs.spec.js

+18-1
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,6 @@ describe('<md-tabs>', function () {
354354
expect(tabs.find('md-tabs-canvas').attr('role')).toBe('tablist');
355355

356356
expect(tabItem.attr('id')).toBeTruthy();
357-
expect(tabItem.attr('role')).toBe('tab');
358357
expect(tabItem.attr('aria-controls')).toBe(tabContent.attr('id'));
359358

360359
expect(tabContent.attr('id')).toBeTruthy();
@@ -364,6 +363,24 @@ describe('<md-tabs>', function () {
364363
//Unique ids check
365364
expect(tabContent.attr('id')).not.toEqual(tabItem.attr('id'));
366365
});
366+
367+
it('should not assign role to dummy tabs', function () {
368+
var tabs = setup('<md-tabs>' +
369+
'<md-tab label="label!">content!</md-tab>' +
370+
'</md-tabs>');
371+
var tabItem = tabs.find('md-dummy-tab');
372+
373+
expect(tabItem.attr('role')).toBeFalsy();
374+
});
375+
376+
it('should assign role to visible tabs', function () {
377+
var tabs = setup('<md-tabs>' +
378+
'<md-tab label="label!">content!</md-tab>' +
379+
'</md-tabs>');
380+
var tabItem = tabs.find('md-tab-item');
381+
382+
expect(tabItem.attr('role')).toBe('tab');
383+
});
367384
});
368385

369386
describe('<md-tab>', function () {

0 commit comments

Comments
 (0)