Skip to content

Commit

Permalink
refactor(cdk/a11y): un-deprecate focus trap (#28768)
Browse files Browse the repository at this point in the history
The `FocusTrap` and `FocusTrapFactory` symbols were marked as deprecated a while ago, but the only way to provide the `ConfigurableFocusTrap` is to reference the deprecated symbols. These changes un-deprecate the former to avoid confusion.

(cherry picked from commit 70d416f)
  • Loading branch information
crisbeto committed Mar 25, 2024
1 parent 7ef32f5 commit 4e32a4f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
5 changes: 0 additions & 5 deletions src/cdk/a11y/focus-trap/focus-trap.ts
Expand Up @@ -32,9 +32,6 @@ import {InteractivityChecker} from '../interactivity-checker/interactivity-check
* This class currently uses a relatively simple approach to focus trapping.
* It assumes that the tab order is the same as DOM order, which is not necessarily true.
* Things like `tabIndex > 0`, flex `order`, and shadow roots can cause the two to be misaligned.
*
* @deprecated Use `ConfigurableFocusTrap` instead.
* @breaking-change 11.0.0
*/
export class FocusTrap {
private _startAnchor: HTMLElement | null;
Expand Down Expand Up @@ -368,8 +365,6 @@ export class FocusTrap {

/**
* Factory that allows easy instantiation of focus traps.
* @deprecated Use `ConfigurableFocusTrapFactory` instead.
* @breaking-change 11.0.0
*/
@Injectable({providedIn: 'root'})
export class FocusTrapFactory {
Expand Down
4 changes: 2 additions & 2 deletions tools/public_api_guard/cdk/a11y.md
Expand Up @@ -217,7 +217,7 @@ export { FocusOptions_2 as FocusOptions }
// @public (undocumented)
export type FocusOrigin = 'touch' | 'mouse' | 'keyboard' | 'program' | null;

// @public @deprecated
// @public
export class FocusTrap {
constructor(_element: HTMLElement, _checker: InteractivityChecker, _ngZone: NgZone, _document: Document, deferAnchors?: boolean);
attachAnchors(): boolean;
Expand Down Expand Up @@ -246,7 +246,7 @@ export class FocusTrap {
protected toggleAnchors(enabled: boolean): void;
}

// @public @deprecated
// @public
export class FocusTrapFactory {
constructor(_checker: InteractivityChecker, _ngZone: NgZone, _document: any);
create(element: HTMLElement, deferCaptureElements?: boolean): FocusTrap;
Expand Down

0 comments on commit 4e32a4f

Please sign in to comment.