source: trip-planner-front/node_modules/@angular/cdk/esm2015/a11y/focus-trap/focus-trap.js@ bdd6491

Last change on this file since bdd6491 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 50.2 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { coerceBooleanProperty } from '@angular/cdk/coercion';
9import { _getFocusedElementPierceShadowDom } from '@angular/cdk/platform';
10import { DOCUMENT } from '@angular/common';
11import { Directive, ElementRef, Inject, Injectable, Input, NgZone, } from '@angular/core';
12import { take } from 'rxjs/operators';
13import { InteractivityChecker } from '../interactivity-checker/interactivity-checker';
14import * as i0 from "@angular/core";
15import * as i1 from "../interactivity-checker/interactivity-checker";
16import * as i2 from "@angular/common";
17/**
18 * Class that allows for trapping focus within a DOM element.
19 *
20 * This class currently uses a relatively simple approach to focus trapping.
21 * It assumes that the tab order is the same as DOM order, which is not necessarily true.
22 * Things like `tabIndex > 0`, flex `order`, and shadow roots can cause the two to be misaligned.
23 *
24 * @deprecated Use `ConfigurableFocusTrap` instead.
25 * @breaking-change 11.0.0
26 */
27export class FocusTrap {
28 constructor(_element, _checker, _ngZone, _document, deferAnchors = false) {
29 this._element = _element;
30 this._checker = _checker;
31 this._ngZone = _ngZone;
32 this._document = _document;
33 this._hasAttached = false;
34 // Event listeners for the anchors. Need to be regular functions so that we can unbind them later.
35 this.startAnchorListener = () => this.focusLastTabbableElement();
36 this.endAnchorListener = () => this.focusFirstTabbableElement();
37 this._enabled = true;
38 if (!deferAnchors) {
39 this.attachAnchors();
40 }
41 }
42 /** Whether the focus trap is active. */
43 get enabled() { return this._enabled; }
44 set enabled(value) {
45 this._enabled = value;
46 if (this._startAnchor && this._endAnchor) {
47 this._toggleAnchorTabIndex(value, this._startAnchor);
48 this._toggleAnchorTabIndex(value, this._endAnchor);
49 }
50 }
51 /** Destroys the focus trap by cleaning up the anchors. */
52 destroy() {
53 const startAnchor = this._startAnchor;
54 const endAnchor = this._endAnchor;
55 if (startAnchor) {
56 startAnchor.removeEventListener('focus', this.startAnchorListener);
57 if (startAnchor.parentNode) {
58 startAnchor.parentNode.removeChild(startAnchor);
59 }
60 }
61 if (endAnchor) {
62 endAnchor.removeEventListener('focus', this.endAnchorListener);
63 if (endAnchor.parentNode) {
64 endAnchor.parentNode.removeChild(endAnchor);
65 }
66 }
67 this._startAnchor = this._endAnchor = null;
68 this._hasAttached = false;
69 }
70 /**
71 * Inserts the anchors into the DOM. This is usually done automatically
72 * in the constructor, but can be deferred for cases like directives with `*ngIf`.
73 * @returns Whether the focus trap managed to attach successfully. This may not be the case
74 * if the target element isn't currently in the DOM.
75 */
76 attachAnchors() {
77 // If we're not on the browser, there can be no focus to trap.
78 if (this._hasAttached) {
79 return true;
80 }
81 this._ngZone.runOutsideAngular(() => {
82 if (!this._startAnchor) {
83 this._startAnchor = this._createAnchor();
84 this._startAnchor.addEventListener('focus', this.startAnchorListener);
85 }
86 if (!this._endAnchor) {
87 this._endAnchor = this._createAnchor();
88 this._endAnchor.addEventListener('focus', this.endAnchorListener);
89 }
90 });
91 if (this._element.parentNode) {
92 this._element.parentNode.insertBefore(this._startAnchor, this._element);
93 this._element.parentNode.insertBefore(this._endAnchor, this._element.nextSibling);
94 this._hasAttached = true;
95 }
96 return this._hasAttached;
97 }
98 /**
99 * Waits for the zone to stabilize, then either focuses the first element that the
100 * user specified, or the first tabbable element.
101 * @returns Returns a promise that resolves with a boolean, depending
102 * on whether focus was moved successfully.
103 */
104 focusInitialElementWhenReady(options) {
105 return new Promise(resolve => {
106 this._executeOnStable(() => resolve(this.focusInitialElement(options)));
107 });
108 }
109 /**
110 * Waits for the zone to stabilize, then focuses
111 * the first tabbable element within the focus trap region.
112 * @returns Returns a promise that resolves with a boolean, depending
113 * on whether focus was moved successfully.
114 */
115 focusFirstTabbableElementWhenReady(options) {
116 return new Promise(resolve => {
117 this._executeOnStable(() => resolve(this.focusFirstTabbableElement(options)));
118 });
119 }
120 /**
121 * Waits for the zone to stabilize, then focuses
122 * the last tabbable element within the focus trap region.
123 * @returns Returns a promise that resolves with a boolean, depending
124 * on whether focus was moved successfully.
125 */
126 focusLastTabbableElementWhenReady(options) {
127 return new Promise(resolve => {
128 this._executeOnStable(() => resolve(this.focusLastTabbableElement(options)));
129 });
130 }
131 /**
132 * Get the specified boundary element of the trapped region.
133 * @param bound The boundary to get (start or end of trapped region).
134 * @returns The boundary element.
135 */
136 _getRegionBoundary(bound) {
137 // Contains the deprecated version of selector, for temporary backwards comparability.
138 let markers = this._element.querySelectorAll(`[cdk-focus-region-${bound}], ` +
139 `[cdkFocusRegion${bound}], ` +
140 `[cdk-focus-${bound}]`);
141 for (let i = 0; i < markers.length; i++) {
142 // @breaking-change 8.0.0
143 if (markers[i].hasAttribute(`cdk-focus-${bound}`)) {
144 console.warn(`Found use of deprecated attribute 'cdk-focus-${bound}', ` +
145 `use 'cdkFocusRegion${bound}' instead. The deprecated ` +
146 `attribute will be removed in 8.0.0.`, markers[i]);
147 }
148 else if (markers[i].hasAttribute(`cdk-focus-region-${bound}`)) {
149 console.warn(`Found use of deprecated attribute 'cdk-focus-region-${bound}', ` +
150 `use 'cdkFocusRegion${bound}' instead. The deprecated attribute ` +
151 `will be removed in 8.0.0.`, markers[i]);
152 }
153 }
154 if (bound == 'start') {
155 return markers.length ? markers[0] : this._getFirstTabbableElement(this._element);
156 }
157 return markers.length ?
158 markers[markers.length - 1] : this._getLastTabbableElement(this._element);
159 }
160 /**
161 * Focuses the element that should be focused when the focus trap is initialized.
162 * @returns Whether focus was moved successfully.
163 */
164 focusInitialElement(options) {
165 // Contains the deprecated version of selector, for temporary backwards comparability.
166 const redirectToElement = this._element.querySelector(`[cdk-focus-initial], ` +
167 `[cdkFocusInitial]`);
168 if (redirectToElement) {
169 // @breaking-change 8.0.0
170 if (redirectToElement.hasAttribute(`cdk-focus-initial`)) {
171 console.warn(`Found use of deprecated attribute 'cdk-focus-initial', ` +
172 `use 'cdkFocusInitial' instead. The deprecated attribute ` +
173 `will be removed in 8.0.0`, redirectToElement);
174 }
175 // Warn the consumer if the element they've pointed to
176 // isn't focusable, when not in production mode.
177 if ((typeof ngDevMode === 'undefined' || ngDevMode) &&
178 !this._checker.isFocusable(redirectToElement)) {
179 console.warn(`Element matching '[cdkFocusInitial]' is not focusable.`, redirectToElement);
180 }
181 if (!this._checker.isFocusable(redirectToElement)) {
182 const focusableChild = this._getFirstTabbableElement(redirectToElement);
183 focusableChild === null || focusableChild === void 0 ? void 0 : focusableChild.focus(options);
184 return !!focusableChild;
185 }
186 redirectToElement.focus(options);
187 return true;
188 }
189 return this.focusFirstTabbableElement(options);
190 }
191 /**
192 * Focuses the first tabbable element within the focus trap region.
193 * @returns Whether focus was moved successfully.
194 */
195 focusFirstTabbableElement(options) {
196 const redirectToElement = this._getRegionBoundary('start');
197 if (redirectToElement) {
198 redirectToElement.focus(options);
199 }
200 return !!redirectToElement;
201 }
202 /**
203 * Focuses the last tabbable element within the focus trap region.
204 * @returns Whether focus was moved successfully.
205 */
206 focusLastTabbableElement(options) {
207 const redirectToElement = this._getRegionBoundary('end');
208 if (redirectToElement) {
209 redirectToElement.focus(options);
210 }
211 return !!redirectToElement;
212 }
213 /**
214 * Checks whether the focus trap has successfully been attached.
215 */
216 hasAttached() {
217 return this._hasAttached;
218 }
219 /** Get the first tabbable element from a DOM subtree (inclusive). */
220 _getFirstTabbableElement(root) {
221 if (this._checker.isFocusable(root) && this._checker.isTabbable(root)) {
222 return root;
223 }
224 // Iterate in DOM order. Note that IE doesn't have `children` for SVG so we fall
225 // back to `childNodes` which includes text nodes, comments etc.
226 let children = root.children || root.childNodes;
227 for (let i = 0; i < children.length; i++) {
228 let tabbableChild = children[i].nodeType === this._document.ELEMENT_NODE ?
229 this._getFirstTabbableElement(children[i]) :
230 null;
231 if (tabbableChild) {
232 return tabbableChild;
233 }
234 }
235 return null;
236 }
237 /** Get the last tabbable element from a DOM subtree (inclusive). */
238 _getLastTabbableElement(root) {
239 if (this._checker.isFocusable(root) && this._checker.isTabbable(root)) {
240 return root;
241 }
242 // Iterate in reverse DOM order.
243 let children = root.children || root.childNodes;
244 for (let i = children.length - 1; i >= 0; i--) {
245 let tabbableChild = children[i].nodeType === this._document.ELEMENT_NODE ?
246 this._getLastTabbableElement(children[i]) :
247 null;
248 if (tabbableChild) {
249 return tabbableChild;
250 }
251 }
252 return null;
253 }
254 /** Creates an anchor element. */
255 _createAnchor() {
256 const anchor = this._document.createElement('div');
257 this._toggleAnchorTabIndex(this._enabled, anchor);
258 anchor.classList.add('cdk-visually-hidden');
259 anchor.classList.add('cdk-focus-trap-anchor');
260 anchor.setAttribute('aria-hidden', 'true');
261 return anchor;
262 }
263 /**
264 * Toggles the `tabindex` of an anchor, based on the enabled state of the focus trap.
265 * @param isEnabled Whether the focus trap is enabled.
266 * @param anchor Anchor on which to toggle the tabindex.
267 */
268 _toggleAnchorTabIndex(isEnabled, anchor) {
269 // Remove the tabindex completely, rather than setting it to -1, because if the
270 // element has a tabindex, the user might still hit it when navigating with the arrow keys.
271 isEnabled ? anchor.setAttribute('tabindex', '0') : anchor.removeAttribute('tabindex');
272 }
273 /**
274 * Toggles the`tabindex` of both anchors to either trap Tab focus or allow it to escape.
275 * @param enabled: Whether the anchors should trap Tab.
276 */
277 toggleAnchors(enabled) {
278 if (this._startAnchor && this._endAnchor) {
279 this._toggleAnchorTabIndex(enabled, this._startAnchor);
280 this._toggleAnchorTabIndex(enabled, this._endAnchor);
281 }
282 }
283 /** Executes a function when the zone is stable. */
284 _executeOnStable(fn) {
285 if (this._ngZone.isStable) {
286 fn();
287 }
288 else {
289 this._ngZone.onStable.pipe(take(1)).subscribe(fn);
290 }
291 }
292}
293/**
294 * Factory that allows easy instantiation of focus traps.
295 * @deprecated Use `ConfigurableFocusTrapFactory` instead.
296 * @breaking-change 11.0.0
297 */
298export class FocusTrapFactory {
299 constructor(_checker, _ngZone, _document) {
300 this._checker = _checker;
301 this._ngZone = _ngZone;
302 this._document = _document;
303 }
304 /**
305 * Creates a focus-trapped region around the given element.
306 * @param element The element around which focus will be trapped.
307 * @param deferCaptureElements Defers the creation of focus-capturing elements to be done
308 * manually by the user.
309 * @returns The created focus trap instance.
310 */
311 create(element, deferCaptureElements = false) {
312 return new FocusTrap(element, this._checker, this._ngZone, this._document, deferCaptureElements);
313 }
314}
315FocusTrapFactory.ɵprov = i0.ɵɵdefineInjectable({ factory: function FocusTrapFactory_Factory() { return new FocusTrapFactory(i0.ɵɵinject(i1.InteractivityChecker), i0.ɵɵinject(i0.NgZone), i0.ɵɵinject(i2.DOCUMENT)); }, token: FocusTrapFactory, providedIn: "root" });
316FocusTrapFactory.decorators = [
317 { type: Injectable, args: [{ providedIn: 'root' },] }
318];
319FocusTrapFactory.ctorParameters = () => [
320 { type: InteractivityChecker },
321 { type: NgZone },
322 { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
323];
324/** Directive for trapping focus within a region. */
325export class CdkTrapFocus {
326 constructor(_elementRef, _focusTrapFactory,
327 /**
328 * @deprecated No longer being used. To be removed.
329 * @breaking-change 13.0.0
330 */
331 _document) {
332 this._elementRef = _elementRef;
333 this._focusTrapFactory = _focusTrapFactory;
334 /** Previously focused element to restore focus to upon destroy when using autoCapture. */
335 this._previouslyFocusedElement = null;
336 this.focusTrap = this._focusTrapFactory.create(this._elementRef.nativeElement, true);
337 }
338 /** Whether the focus trap is active. */
339 get enabled() { return this.focusTrap.enabled; }
340 set enabled(value) { this.focusTrap.enabled = coerceBooleanProperty(value); }
341 /**
342 * Whether the directive should automatically move focus into the trapped region upon
343 * initialization and return focus to the previous activeElement upon destruction.
344 */
345 get autoCapture() { return this._autoCapture; }
346 set autoCapture(value) { this._autoCapture = coerceBooleanProperty(value); }
347 ngOnDestroy() {
348 this.focusTrap.destroy();
349 // If we stored a previously focused element when using autoCapture, return focus to that
350 // element now that the trapped region is being destroyed.
351 if (this._previouslyFocusedElement) {
352 this._previouslyFocusedElement.focus();
353 this._previouslyFocusedElement = null;
354 }
355 }
356 ngAfterContentInit() {
357 this.focusTrap.attachAnchors();
358 if (this.autoCapture) {
359 this._captureFocus();
360 }
361 }
362 ngDoCheck() {
363 if (!this.focusTrap.hasAttached()) {
364 this.focusTrap.attachAnchors();
365 }
366 }
367 ngOnChanges(changes) {
368 const autoCaptureChange = changes['autoCapture'];
369 if (autoCaptureChange && !autoCaptureChange.firstChange && this.autoCapture &&
370 this.focusTrap.hasAttached()) {
371 this._captureFocus();
372 }
373 }
374 _captureFocus() {
375 this._previouslyFocusedElement = _getFocusedElementPierceShadowDom();
376 this.focusTrap.focusInitialElementWhenReady();
377 }
378}
379CdkTrapFocus.decorators = [
380 { type: Directive, args: [{
381 selector: '[cdkTrapFocus]',
382 exportAs: 'cdkTrapFocus',
383 },] }
384];
385CdkTrapFocus.ctorParameters = () => [
386 { type: ElementRef },
387 { type: FocusTrapFactory },
388 { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
389];
390CdkTrapFocus.propDecorators = {
391 enabled: [{ type: Input, args: ['cdkTrapFocus',] }],
392 autoCapture: [{ type: Input, args: ['cdkTrapFocusAutoCapture',] }]
393};
394//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9jdXMtdHJhcC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9jZGsvYTExeS9mb2N1cy10cmFwL2ZvY3VzLXRyYXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgsT0FBTyxFQUFlLHFCQUFxQixFQUFDLE1BQU0sdUJBQXVCLENBQUM7QUFDMUUsT0FBTyxFQUFDLGlDQUFpQyxFQUFDLE1BQU0sdUJBQXVCLENBQUM7QUFDeEUsT0FBTyxFQUFDLFFBQVEsRUFBQyxNQUFNLGlC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