Skip to content

Commit

Permalink
fix(stepper): remove tabindex from content
Browse files Browse the repository at this point in the history
A while ago in #14892 we added a `tabindex` to the content of the current step, however since then we consulted with the a11y team and it looks like adding the `tabindex` there isn't the best approach.

Fixes #16692.
  • Loading branch information
crisbeto committed Oct 26, 2019
1 parent f0df308 commit cbbd31f
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 19 deletions.
1 change: 0 additions & 1 deletion src/material/stepper/stepper-horizontal.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

<div class="mat-horizontal-content-container">
<div *ngFor="let step of _stepsArray; let i = index"
[attr.tabindex]="selectedIndex === i ? 0 : null"
class="mat-horizontal-stepper-content" role="tabpanel"
[@stepTransition]="_getAnimationDirection(i)"
(@stepTransition.done)="_animationDone.next($event)"
Expand Down
1 change: 0 additions & 1 deletion src/material/stepper/stepper-vertical.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

<div class="mat-vertical-content-container" [class.mat-stepper-vertical-line]="!isLast">
<div class="mat-vertical-stepper-content" role="tabpanel"
[attr.tabindex]="selectedIndex === i ? 0 : null"
[@stepTransition]="_getAnimationDirection(i)"
(@stepTransition.done)="_animationDone.next($event)"
[id]="_getStepContentId(i)"
Expand Down
17 changes: 0 additions & 17 deletions src/material/stepper/stepper.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,23 +377,6 @@ describe('MatStepper', () => {
assertSelectKeyWithModifierInteraction(fixture, stepHeaders, 'vertical', SPACE);
});

it('should set the proper tabindex', () => {
let stepContents = fixture.debugElement.queryAll(By.css(`.mat-vertical-stepper-content`));
let stepperComponent =
fixture.debugElement.query(By.directive(MatStepper))!.componentInstance;
let firstStepContentEl = stepContents[0].nativeElement;
let secondStepContentEl = stepContents[1].nativeElement;

expect(firstStepContentEl.getAttribute('tabindex')).toBe('0');
expect(secondStepContentEl.getAttribute('tabindex')).toBeFalsy();

stepperComponent.selectedIndex = 1;
fixture.detectChanges();

expect(firstStepContentEl.getAttribute('tabindex')).toBeFalsy();
expect(secondStepContentEl.getAttribute('tabindex')).toBe('0');
});

});

describe('basic stepper when attempting to set the selected step too early', () => {
Expand Down

0 comments on commit cbbd31f

Please sign in to comment.