|
6 | 6 | * found in the LICENSE file at https://angular.io/license
|
7 | 7 | */
|
8 | 8 | import {FocusableOption, FocusMonitor} from '@angular/cdk/a11y';
|
| 9 | +import {SPACE} from '@angular/cdk/keycodes'; |
9 | 10 | import {Directionality} from '@angular/cdk/bidi';
|
10 | 11 | import {BooleanInput, coerceBooleanProperty, NumberInput} from '@angular/cdk/coercion';
|
11 | 12 | import {Platform} from '@angular/cdk/platform';
|
@@ -296,8 +297,8 @@ export class _MatTabLinkBase
|
296 | 297 | this._tabNavBar.focusIndex = this._getIndex();
|
297 | 298 | }
|
298 | 299 |
|
299 |
| - _handleSpace() { |
300 |
| - if (this._tabNavBar.panel) { |
| 300 | + _handleKeydown(event: KeyboardEvent) { |
| 301 | + if (this._tabNavBar.panel && event.keyCode === SPACE) { |
301 | 302 | this.elementRef.nativeElement.click();
|
302 | 303 | }
|
303 | 304 | }
|
@@ -345,7 +346,7 @@ export class _MatTabLinkBase
|
345 | 346 | '[class.mat-tab-disabled]': 'disabled',
|
346 | 347 | '[class.mat-tab-label-active]': 'active',
|
347 | 348 | '(focus)': '_handleFocus()',
|
348 |
| - '(keydown.space)': '_handleSpace()', |
| 349 | + '(keydown)': '_handleKeydown($event)', |
349 | 350 | },
|
350 | 351 | })
|
351 | 352 | export class MatTabLink extends _MatTabLinkBase implements OnDestroy {
|
@@ -379,15 +380,14 @@ export class MatTabLink extends _MatTabLinkBase implements OnDestroy {
|
379 | 380 | @Component({
|
380 | 381 | selector: 'mat-tab-nav-panel',
|
381 | 382 | exportAs: 'matTabNavPanel',
|
382 |
| - template: '<ng-content select="router-outlet"></ng-content>', |
| 383 | + template: '<ng-content></ng-content>', |
383 | 384 | host: {
|
384 | 385 | '[attr.aria-labelledby]': '_activeTabId',
|
385 | 386 | '[attr.id]': 'id',
|
386 | 387 | 'role': 'tabpanel',
|
387 | 388 | },
|
388 | 389 | encapsulation: ViewEncapsulation.None,
|
389 |
| - // tslint:disable-next-line:validate-decorators |
390 |
| - changeDetection: ChangeDetectionStrategy.Default, |
| 390 | + changeDetection: ChangeDetectionStrategy.OnPush, |
391 | 391 | })
|
392 | 392 | export class MatTabNavPanel {
|
393 | 393 | /** Unique id for the tab panel. */
|
|
0 commit comments