Skip to content

Commit 59335c3

Browse files
committed
feat(material/tabs): Code review feedback
1 parent 918262e commit 59335c3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/material/tabs/tab-nav-bar/tab-nav-bar.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88
import {FocusableOption, FocusMonitor} from '@angular/cdk/a11y';
9+
import {SPACE} from '@angular/cdk/keycodes';
910
import {Directionality} from '@angular/cdk/bidi';
1011
import {BooleanInput, coerceBooleanProperty, NumberInput} from '@angular/cdk/coercion';
1112
import {Platform} from '@angular/cdk/platform';
@@ -296,8 +297,8 @@ export class _MatTabLinkBase
296297
this._tabNavBar.focusIndex = this._getIndex();
297298
}
298299

299-
_handleSpace() {
300-
if (this._tabNavBar.panel) {
300+
_handleKeydown(event: KeyboardEvent) {
301+
if (this._tabNavBar.panel && event.keyCode === SPACE) {
301302
this.elementRef.nativeElement.click();
302303
}
303304
}
@@ -345,7 +346,7 @@ export class _MatTabLinkBase
345346
'[class.mat-tab-disabled]': 'disabled',
346347
'[class.mat-tab-label-active]': 'active',
347348
'(focus)': '_handleFocus()',
348-
'(keydown.space)': '_handleSpace()',
349+
'(keydown)': '_handleKeydown($event)',
349350
},
350351
})
351352
export class MatTabLink extends _MatTabLinkBase implements OnDestroy {
@@ -379,15 +380,14 @@ export class MatTabLink extends _MatTabLinkBase implements OnDestroy {
379380
@Component({
380381
selector: 'mat-tab-nav-panel',
381382
exportAs: 'matTabNavPanel',
382-
template: '<ng-content select="router-outlet"></ng-content>',
383+
template: '<ng-content></ng-content>',
383384
host: {
384385
'[attr.aria-labelledby]': '_activeTabId',
385386
'[attr.id]': 'id',
386387
'role': 'tabpanel',
387388
},
388389
encapsulation: ViewEncapsulation.None,
389-
// tslint:disable-next-line:validate-decorators
390-
changeDetection: ChangeDetectionStrategy.Default,
390+
changeDetection: ChangeDetectionStrategy.OnPush,
391391
})
392392
export class MatTabNavPanel {
393393
/** Unique id for the tab panel. */

0 commit comments

Comments
 (0)