Skip to content

Commit ce6cc0b

Browse files
josephperrottandrewseguin
authored andcommitted
Make isFocusTrapEnabled internal, removing it from docs. (#7298)
BREAKING CHANGE: `isFocusTrapEnabled` is now properly marked internal.
1 parent fe0864b commit ce6cc0b

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/cdk/a11y/focus-trap.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ describe('FocusTrap', () => {
103103

104104
expect(anchors.every(current => current.getAttribute('tabindex') === '0')).toBe(true);
105105

106-
fixture.componentInstance.isFocusTrapEnabled = false;
106+
fixture.componentInstance._isFocusTrapEnabled = false;
107107
fixture.detectChanges();
108108

109109
expect(anchors.every(current => current.getAttribute('tabindex') === '-1')).toBe(true);
@@ -172,7 +172,7 @@ class SimpleFocusTrap {
172172

173173
@Component({
174174
template: `
175-
<div *ngIf="renderFocusTrap" [cdkTrapFocus]="isFocusTrapEnabled">
175+
<div *ngIf="renderFocusTrap" [cdkTrapFocus]="_isFocusTrapEnabled">
176176
<input>
177177
<button>SAVE</button>
178178
</div>
@@ -181,7 +181,7 @@ class SimpleFocusTrap {
181181
class FocusTrapWithBindings {
182182
@ViewChild(FocusTrapDirective) focusTrapDirective: FocusTrapDirective;
183183
renderFocusTrap = true;
184-
isFocusTrapEnabled = true;
184+
_isFocusTrapEnabled = true;
185185
}
186186

187187

src/lib/sidenav/drawer.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ export class MatDrawer implements AfterContentInit, OnDestroy {
211211
*/
212212
_modeChanged = new Subject();
213213

214-
get isFocusTrapEnabled() {
214+
get _isFocusTrapEnabled() {
215215
// The focus trap is only enabled when the drawer is open in any mode other than side.
216216
return this.opened && this.mode !== 'side';
217217
}
@@ -224,7 +224,7 @@ export class MatDrawer implements AfterContentInit, OnDestroy {
224224
this._elementFocusedBeforeDrawerWasOpened = this._doc.activeElement as HTMLElement;
225225
}
226226

227-
if (this.isFocusTrapEnabled && this._focusTrap) {
227+
if (this._isFocusTrapEnabled && this._focusTrap) {
228228
this._focusTrap.focusInitialElementWhenReady();
229229
}
230230
});
@@ -251,7 +251,7 @@ export class MatDrawer implements AfterContentInit, OnDestroy {
251251

252252
ngAfterContentInit() {
253253
this._focusTrap = this._focusTrapFactory.create(this._elementRef.nativeElement);
254-
this._focusTrap.enabled = this.isFocusTrapEnabled;
254+
this._focusTrap.enabled = this._isFocusTrapEnabled;
255255
this._enableAnimations = true;
256256
}
257257

@@ -301,7 +301,7 @@ export class MatDrawer implements AfterContentInit, OnDestroy {
301301
});
302302

303303
if (this._focusTrap) {
304-
this._focusTrap.enabled = this.isFocusTrapEnabled;
304+
this._focusTrap.enabled = this._isFocusTrapEnabled;
305305
}
306306
}
307307

0 commit comments

Comments
 (0)