mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
Make isFocusTrapEnabled internal, removing it from docs. (#7298)
BREAKING CHANGE: `isFocusTrapEnabled` is now properly marked internal.
This commit is contained in:
committed by
Andrew Seguin
parent
fe0864b8a9
commit
ce6cc0bb78
@@ -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: `
|
||||
<div *ngIf="renderFocusTrap" [cdkTrapFocus]="isFocusTrapEnabled">
|
||||
<div *ngIf="renderFocusTrap" [cdkTrapFocus]="_isFocusTrapEnabled">
|
||||
<input>
|
||||
<button>SAVE</button>
|
||||
</div>
|
||||
@@ -181,7 +181,7 @@ class SimpleFocusTrap {
|
||||
class FocusTrapWithBindings {
|
||||
@ViewChild(FocusTrapDirective) focusTrapDirective: FocusTrapDirective;
|
||||
renderFocusTrap = true;
|
||||
isFocusTrapEnabled = true;
|
||||
_isFocusTrapEnabled = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user