From ce6cc0bb78d93c9dddbb5b34831092905e2af387 Mon Sep 17 00:00:00 2001 From: Joey Perrott Date: Fri, 29 Sep 2017 13:03:44 -0700 Subject: [PATCH] Make `isFocusTrapEnabled` internal, removing it from docs. (#7298) BREAKING CHANGE: `isFocusTrapEnabled` is now properly marked internal. --- src/cdk/a11y/focus-trap.spec.ts | 6 +++--- src/lib/sidenav/drawer.ts | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/cdk/a11y/focus-trap.spec.ts b/src/cdk/a11y/focus-trap.spec.ts index 4ccae568849..debc77a138f 100644 --- a/src/cdk/a11y/focus-trap.spec.ts +++ b/src/cdk/a11y/focus-trap.spec.ts @@ -103,7 +103,7 @@ describe('FocusTrap', () => { expect(anchors.every(current => current.getAttribute('tabindex') === '0')).toBe(true); - fixture.componentInstance.isFocusTrapEnabled = false; + fixture.componentInstance._isFocusTrapEnabled = false; fixture.detectChanges(); expect(anchors.every(current => current.getAttribute('tabindex') === '-1')).toBe(true); @@ -172,7 +172,7 @@ class SimpleFocusTrap { @Component({ template: ` -
+
@@ -181,7 +181,7 @@ class SimpleFocusTrap { class FocusTrapWithBindings { @ViewChild(FocusTrapDirective) focusTrapDirective: FocusTrapDirective; renderFocusTrap = true; - isFocusTrapEnabled = true; + _isFocusTrapEnabled = true; } diff --git a/src/lib/sidenav/drawer.ts b/src/lib/sidenav/drawer.ts index 9cf024098eb..deb90d49abb 100644 --- a/src/lib/sidenav/drawer.ts +++ b/src/lib/sidenav/drawer.ts @@ -211,7 +211,7 @@ export class MatDrawer implements AfterContentInit, OnDestroy { */ _modeChanged = new Subject(); - get isFocusTrapEnabled() { + get _isFocusTrapEnabled() { // The focus trap is only enabled when the drawer is open in any mode other than side. return this.opened && this.mode !== 'side'; } @@ -224,7 +224,7 @@ export class MatDrawer implements AfterContentInit, OnDestroy { this._elementFocusedBeforeDrawerWasOpened = this._doc.activeElement as HTMLElement; } - if (this.isFocusTrapEnabled && this._focusTrap) { + if (this._isFocusTrapEnabled && this._focusTrap) { this._focusTrap.focusInitialElementWhenReady(); } }); @@ -251,7 +251,7 @@ export class MatDrawer implements AfterContentInit, OnDestroy { ngAfterContentInit() { this._focusTrap = this._focusTrapFactory.create(this._elementRef.nativeElement); - this._focusTrap.enabled = this.isFocusTrapEnabled; + this._focusTrap.enabled = this._isFocusTrapEnabled; this._enableAnimations = true; } @@ -301,7 +301,7 @@ export class MatDrawer implements AfterContentInit, OnDestroy { }); if (this._focusTrap) { - this._focusTrap.enabled = this.isFocusTrapEnabled; + this._focusTrap.enabled = this._isFocusTrapEnabled; } }