@angular/cdk 10.0.2 → 10.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/a11y/aria-describer/aria-describer.d.ts +10 -1
- package/a11y/index.metadata.json +1 -1
- package/a11y/interactivity-checker/interactivity-checker.d.ts +11 -1
- package/a11y/key-manager/list-key-manager.d.ts +6 -0
- package/accordion/accordion.d.ts +7 -1
- package/accordion/index.d.ts +1 -0
- package/accordion/index.metadata.json +1 -1
- package/bundles/cdk-a11y.umd.js +514 -410
- package/bundles/cdk-a11y.umd.js.map +1 -1
- package/bundles/cdk-a11y.umd.min.js +35 -11
- package/bundles/cdk-a11y.umd.min.js.map +1 -1
- package/bundles/cdk-accordion.umd.js +47 -39
- package/bundles/cdk-accordion.umd.js.map +1 -1
- package/bundles/cdk-accordion.umd.min.js +10 -2
- package/bundles/cdk-accordion.umd.min.js.map +1 -1
- package/bundles/cdk-bidi.umd.js +25 -25
- package/bundles/cdk-bidi.umd.js.map +1 -1
- package/bundles/cdk-bidi.umd.min.js +5 -4
- package/bundles/cdk-bidi.umd.min.js.map +1 -1
- package/bundles/cdk-clipboard.umd.js +37 -36
- package/bundles/cdk-clipboard.umd.js.map +1 -1
- package/bundles/cdk-clipboard.umd.min.js +10 -2
- package/bundles/cdk-clipboard.umd.min.js.map +1 -1
- package/bundles/cdk-coercion.umd.js.map +1 -1
- package/bundles/cdk-collections.umd.js +303 -237
- package/bundles/cdk-collections.umd.js.map +1 -1
- package/bundles/cdk-collections.umd.min.js +3 -9
- package/bundles/cdk-collections.umd.min.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.js +1059 -927
- package/bundles/cdk-drag-drop.umd.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.min.js +72 -10
- package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
- package/bundles/cdk-keycodes.umd.js.map +1 -1
- package/bundles/cdk-layout.umd.js +18 -18
- package/bundles/cdk-layout.umd.js.map +1 -1
- package/bundles/cdk-layout.umd.min.js +6 -5
- package/bundles/cdk-layout.umd.min.js.map +1 -1
- package/bundles/cdk-observers.umd.js +34 -34
- package/bundles/cdk-observers.umd.js.map +1 -1
- package/bundles/cdk-observers.umd.min.js +2 -2
- package/bundles/cdk-observers.umd.min.js.map +1 -1
- package/bundles/cdk-overlay.umd.js +638 -416
- package/bundles/cdk-overlay.umd.js.map +1 -1
- package/bundles/cdk-overlay.umd.min.js +51 -12
- package/bundles/cdk-overlay.umd.min.js.map +1 -1
- package/bundles/cdk-platform.umd.js +10 -10
- package/bundles/cdk-platform.umd.js.map +1 -1
- package/bundles/cdk-platform.umd.min.js +4 -11
- package/bundles/cdk-platform.umd.min.js.map +1 -1
- package/bundles/cdk-portal.umd.js +355 -300
- package/bundles/cdk-portal.umd.js.map +1 -1
- package/bundles/cdk-portal.umd.min.js +4 -5
- package/bundles/cdk-portal.umd.min.js.map +1 -1
- package/bundles/cdk-scrolling.umd.js +482 -392
- package/bundles/cdk-scrolling.umd.js.map +1 -1
- package/bundles/cdk-scrolling.umd.min.js +20 -12
- package/bundles/cdk-scrolling.umd.min.js.map +1 -1
- package/bundles/cdk-stepper.umd.js +117 -117
- package/bundles/cdk-stepper.umd.js.map +1 -1
- package/bundles/cdk-stepper.umd.min.js +11 -2
- package/bundles/cdk-stepper.umd.min.js.map +1 -1
- package/bundles/cdk-table.umd.js +862 -607
- package/bundles/cdk-table.umd.js.map +1 -1
- package/bundles/cdk-table.umd.min.js +8 -15
- package/bundles/cdk-table.umd.min.js.map +1 -1
- package/bundles/cdk-testing-protractor.umd.js +300 -241
- package/bundles/cdk-testing-protractor.umd.js.map +1 -1
- package/bundles/cdk-testing-protractor.umd.min.js +2 -9
- package/bundles/cdk-testing-protractor.umd.min.js.map +1 -1
- package/bundles/cdk-testing-testbed.umd.js +337 -276
- package/bundles/cdk-testing-testbed.umd.js.map +1 -1
- package/bundles/cdk-testing-testbed.umd.min.js +7 -30
- package/bundles/cdk-testing-testbed.umd.min.js.map +1 -1
- package/bundles/cdk-testing.umd.js +358 -270
- package/bundles/cdk-testing.umd.js.map +1 -1
- package/bundles/cdk-testing.umd.min.js +3 -18
- package/bundles/cdk-testing.umd.min.js.map +1 -1
- package/bundles/cdk-text-field.umd.js +51 -51
- package/bundles/cdk-text-field.umd.js.map +1 -1
- package/bundles/cdk-text-field.umd.min.js +10 -2
- package/bundles/cdk-text-field.umd.min.js.map +1 -1
- package/bundles/cdk-tree.umd.js +449 -396
- package/bundles/cdk-tree.umd.js.map +1 -1
- package/bundles/cdk-tree.umd.min.js +28 -3
- package/bundles/cdk-tree.umd.min.js.map +1 -1
- package/bundles/cdk.umd.js +1 -1
- package/bundles/cdk.umd.js.map +1 -1
- package/bundles/cdk.umd.min.js +1 -1
- package/bundles/cdk.umd.min.js.map +1 -1
- package/drag-drop/clone-node.d.ts +9 -0
- package/drag-drop/directives/drag-handle.d.ts +8 -2
- package/drag-drop/directives/drag-placeholder.d.ts +7 -1
- package/drag-drop/directives/drag-preview.d.ts +7 -1
- package/drag-drop/directives/drag.d.ts +3 -7
- package/drag-drop/directives/drop-list-group.d.ts +7 -1
- package/drag-drop/directives/drop-list.d.ts +7 -1
- package/drag-drop/index.d.ts +2 -2
- package/drag-drop/index.metadata.json +1 -1
- package/drag-drop/parent-position-tracker.d.ts +1 -1
- package/esm2015/a11y/aria-describer/aria-describer.js +21 -7
- package/esm2015/a11y/focus-trap/configurable-focus-trap-factory.js +3 -3
- package/esm2015/a11y/focus-trap/focus-trap.js +1 -1
- package/esm2015/a11y/interactivity-checker/interactivity-checker.js +43 -30
- package/esm2015/a11y/key-manager/list-key-manager.js +27 -2
- package/esm2015/a11y/live-announcer/live-announcer.js +1 -1
- package/esm2015/accordion/accordion-item.js +7 -7
- package/esm2015/accordion/accordion.js +9 -2
- package/esm2015/accordion/index.js +2 -1
- package/esm2015/clipboard/pending-copy.js +7 -6
- package/esm2015/drag-drop/clone-node.js +54 -0
- package/esm2015/drag-drop/directives/drag-handle.js +12 -5
- package/esm2015/drag-drop/directives/drag-placeholder.js +10 -3
- package/esm2015/drag-drop/directives/drag-preview.js +10 -3
- package/esm2015/drag-drop/directives/drag.js +19 -15
- package/esm2015/drag-drop/directives/drop-list-group.js +9 -2
- package/esm2015/drag-drop/directives/drop-list.js +19 -8
- package/esm2015/drag-drop/drag-ref.js +2 -29
- package/esm2015/drag-drop/index.js +3 -2
- package/esm2015/layout/breakpoints-observer.js +1 -1
- package/esm2015/overlay/dispatchers/base-overlay-dispatcher.js +51 -0
- package/esm2015/overlay/dispatchers/index.js +10 -0
- package/esm2015/overlay/dispatchers/overlay-keyboard-dispatcher.js +79 -0
- package/esm2015/overlay/dispatchers/overlay-outside-click-dispatcher.js +94 -0
- package/esm2015/overlay/index.js +5 -4
- package/esm2015/overlay/overlay-config.js +5 -1
- package/esm2015/overlay/overlay-directives.js +34 -8
- package/esm2015/overlay/overlay-module.js +2 -2
- package/esm2015/overlay/overlay-ref.js +24 -2
- package/esm2015/overlay/overlay-reference.js +1 -1
- package/esm2015/overlay/overlay.js +10 -5
- package/esm2015/overlay/position/connected-position-strategy.js +1 -5
- package/esm2015/overlay/position/flexible-connected-position-strategy.js +3 -3
- package/esm2015/overlay/position/overlay-position-builder.js +1 -1
- package/esm2015/overlay/public-api.js +2 -2
- package/esm2015/portal/dom-portal-outlet.js +5 -2
- package/esm2015/scrolling/public-api.js +2 -1
- package/esm2015/scrolling/scrolling-module.js +4 -1
- package/esm2015/scrolling/viewport-ruler.js +24 -10
- package/esm2015/scrolling/virtual-for-of.js +26 -12
- package/esm2015/scrolling/virtual-scroll-repeater.js +8 -0
- package/esm2015/scrolling/virtual-scroll-viewport.js +2 -2
- package/esm2015/table/cell.js +18 -3
- package/esm2015/table/coalesced-style-scheduler.js +87 -0
- package/esm2015/table/public-api.js +2 -1
- package/esm2015/table/sticky-styler.js +79 -45
- package/esm2015/table/table.js +33 -12
- package/esm2015/testing/component-harness.js +19 -1
- package/esm2015/testing/harness-environment.js +7 -1
- package/esm2015/testing/testbed/fake-events/dispatch-events.js +5 -4
- package/esm2015/testing/testbed/fake-events/event-objects.js +10 -7
- package/esm2015/testing/testbed/fake-events/type-in-element.js +4 -4
- package/esm2015/testing/testbed/unit-test-element.js +20 -12
- package/esm2015/tree/control/nested-tree-control.js +7 -3
- package/esm2015/tree/tree.js +9 -23
- package/esm2015/version.js +1 -1
- package/fesm2015/a11y.js +88 -38
- package/fesm2015/a11y.js.map +1 -1
- package/fesm2015/accordion.js +13 -6
- package/fesm2015/accordion.js.map +1 -1
- package/fesm2015/cdk.js +1 -1
- package/fesm2015/cdk.js.map +1 -1
- package/fesm2015/clipboard.js +6 -5
- package/fesm2015/clipboard.js.map +1 -1
- package/fesm2015/drag-drop.js +669 -600
- package/fesm2015/drag-drop.js.map +1 -1
- package/fesm2015/overlay.js +215 -40
- package/fesm2015/overlay.js.map +1 -1
- package/fesm2015/portal.js +4 -1
- package/fesm2015/portal.js.map +1 -1
- package/fesm2015/scrolling.js +60 -21
- package/fesm2015/scrolling.js.map +1 -1
- package/fesm2015/table.js +214 -61
- package/fesm2015/table.js.map +1 -1
- package/fesm2015/testing/testbed.js +35 -23
- package/fesm2015/testing/testbed.js.map +1 -1
- package/fesm2015/testing.js +25 -1
- package/fesm2015/testing.js.map +1 -1
- package/fesm2015/tree.js +13 -23
- package/fesm2015/tree.js.map +1 -1
- package/overlay/dispatchers/base-overlay-dispatcher.d.ts +28 -0
- package/overlay/dispatchers/index.d.ts +9 -0
- package/overlay/{keyboard → dispatchers}/overlay-keyboard-dispatcher.d.ts +4 -10
- package/overlay/dispatchers/overlay-outside-click-dispatcher.d.ts +27 -0
- package/overlay/index.d.ts +4 -3
- package/overlay/index.metadata.json +1 -1
- package/overlay/overlay-config.d.ts +4 -0
- package/overlay/overlay-directives.d.ts +5 -0
- package/overlay/overlay-ref.d.ts +8 -2
- package/overlay/overlay-reference.d.ts +1 -0
- package/overlay/overlay.d.ts +4 -2
- package/overlay/position/connected-position-strategy.d.ts +0 -2
- package/overlay/public-api.d.ts +1 -1
- package/package.json +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/scrolling/index.metadata.json +1 -1
- package/scrolling/public-api.d.ts +1 -0
- package/scrolling/scrolling-module.d.ts +3 -0
- package/scrolling/viewport-ruler.d.ts +2 -2
- package/scrolling/virtual-for-of.d.ts +2 -1
- package/scrolling/virtual-scroll-repeater.d.ts +16 -0
- package/scrolling/virtual-scroll-viewport.d.ts +4 -4
- package/table/cell.d.ts +13 -0
- package/table/coalesced-style-scheduler.d.ts +41 -0
- package/table/index.metadata.json +1 -1
- package/table/public-api.d.ts +1 -0
- package/table/sticky-styler.d.ts +7 -1
- package/table/table.d.ts +9 -1
- package/testing/component-harness.d.ts +12 -0
- package/testing/harness-environment.d.ts +1 -0
- package/testing/testbed/fake-events/dispatch-events.d.ts +3 -2
- package/testing/testbed/fake-events/event-objects.d.ts +2 -2
- package/testing/testbed/unit-test-element.d.ts +7 -0
- package/tree/control/nested-tree-control.d.ts +7 -2
- package/tree/index.metadata.json +1 -1
- package/tree/tree.d.ts +2 -4
- package/esm2015/overlay/keyboard/overlay-keyboard-dispatcher.js +0 -96
package/fesm2015/a11y.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { DOCUMENT } from '@angular/common';
|
|
2
2
|
import { ɵɵdefineInjectable, ɵɵinject, Injectable, Inject, QueryList, isDevMode, NgZone, Directive, ElementRef, Input, InjectionToken, Optional, EventEmitter, Output, NgModule } from '@angular/core';
|
|
3
|
+
import { Platform, normalizePassiveListenerOptions, _getShadowRoot, PlatformModule } from '@angular/cdk/platform';
|
|
3
4
|
import { Subject, Subscription, of } from 'rxjs';
|
|
4
|
-
import { hasModifierKey, A, Z, ZERO, NINE, LEFT_ARROW, RIGHT_ARROW, UP_ARROW, DOWN_ARROW, TAB } from '@angular/cdk/keycodes';
|
|
5
|
+
import { hasModifierKey, A, Z, ZERO, NINE, END, HOME, LEFT_ARROW, RIGHT_ARROW, UP_ARROW, DOWN_ARROW, TAB } from '@angular/cdk/keycodes';
|
|
5
6
|
import { tap, debounceTime, filter, map, take } from 'rxjs/operators';
|
|
6
7
|
import { coerceBooleanProperty, coerceElement } from '@angular/cdk/coercion';
|
|
7
|
-
import { Platform, normalizePassiveListenerOptions, _getShadowRoot, PlatformModule } from '@angular/cdk/platform';
|
|
8
8
|
import { ContentObserver, ObserversModule } from '@angular/cdk/observers';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -76,7 +76,12 @@ let messagesContainer = null;
|
|
|
76
76
|
* content.
|
|
77
77
|
*/
|
|
78
78
|
class AriaDescriber {
|
|
79
|
-
constructor(_document
|
|
79
|
+
constructor(_document,
|
|
80
|
+
/**
|
|
81
|
+
* @breaking-change 8.0.0 `_platform` parameter to be made required.
|
|
82
|
+
*/
|
|
83
|
+
_platform) {
|
|
84
|
+
this._platform = _platform;
|
|
80
85
|
this._document = _document;
|
|
81
86
|
}
|
|
82
87
|
/**
|
|
@@ -102,7 +107,7 @@ class AriaDescriber {
|
|
|
102
107
|
}
|
|
103
108
|
/** Removes the host element's aria-describedby reference to the message element. */
|
|
104
109
|
removeDescription(hostElement, message) {
|
|
105
|
-
if (!this._isElementNode(hostElement)) {
|
|
110
|
+
if (!message || !this._isElementNode(hostElement)) {
|
|
106
111
|
return;
|
|
107
112
|
}
|
|
108
113
|
if (this._isElementDescribedByMessage(hostElement, message)) {
|
|
@@ -162,6 +167,8 @@ class AriaDescriber {
|
|
|
162
167
|
/** Creates the global container for all aria-describedby messages. */
|
|
163
168
|
_createMessagesContainer() {
|
|
164
169
|
if (!messagesContainer) {
|
|
170
|
+
// @breaking-change 8.0.0 `_platform` null check can be removed once the parameter is required
|
|
171
|
+
const canBeAriaHidden = !this._platform || (!this._platform.EDGE && !this._platform.TRIDENT);
|
|
165
172
|
const preExistingContainer = this._document.getElementById(MESSAGES_CONTAINER_ID);
|
|
166
173
|
// When going from the server to the client, we may end up in a situation where there's
|
|
167
174
|
// already a container on the page, but we don't have a reference to it. Clear the
|
|
@@ -172,8 +179,12 @@ class AriaDescriber {
|
|
|
172
179
|
}
|
|
173
180
|
messagesContainer = this._document.createElement('div');
|
|
174
181
|
messagesContainer.id = MESSAGES_CONTAINER_ID;
|
|
175
|
-
messagesContainer.
|
|
176
|
-
|
|
182
|
+
messagesContainer.classList.add('cdk-visually-hidden');
|
|
183
|
+
// IE and Edge won't read out the messages if they're in an `aria-hidden` container.
|
|
184
|
+
// We only disable `aria-hidden` for these platforms, because it comes with the
|
|
185
|
+
// disadvantage that people might hit the messages when they've navigated past
|
|
186
|
+
// the end of the document using the arrow keys.
|
|
187
|
+
messagesContainer.setAttribute('aria-hidden', canBeAriaHidden + '');
|
|
177
188
|
this._document.body.appendChild(messagesContainer);
|
|
178
189
|
}
|
|
179
190
|
}
|
|
@@ -242,12 +253,13 @@ class AriaDescriber {
|
|
|
242
253
|
return element.nodeType === this._document.ELEMENT_NODE;
|
|
243
254
|
}
|
|
244
255
|
}
|
|
245
|
-
AriaDescriber.ɵprov = ɵɵdefineInjectable({ factory: function AriaDescriber_Factory() { return new AriaDescriber(ɵɵinject(DOCUMENT)); }, token: AriaDescriber, providedIn: "root" });
|
|
256
|
+
AriaDescriber.ɵprov = ɵɵdefineInjectable({ factory: function AriaDescriber_Factory() { return new AriaDescriber(ɵɵinject(DOCUMENT), ɵɵinject(Platform)); }, token: AriaDescriber, providedIn: "root" });
|
|
246
257
|
AriaDescriber.decorators = [
|
|
247
258
|
{ type: Injectable, args: [{ providedIn: 'root' },] }
|
|
248
259
|
];
|
|
249
260
|
AriaDescriber.ctorParameters = () => [
|
|
250
|
-
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
|
|
261
|
+
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
|
|
262
|
+
{ type: Platform }
|
|
251
263
|
];
|
|
252
264
|
|
|
253
265
|
/**
|
|
@@ -271,6 +283,7 @@ class ListKeyManager {
|
|
|
271
283
|
this._typeaheadSubscription = Subscription.EMPTY;
|
|
272
284
|
this._vertical = true;
|
|
273
285
|
this._allowedModifierKeys = [];
|
|
286
|
+
this._homeAndEnd = false;
|
|
274
287
|
/**
|
|
275
288
|
* Predicate function that can be used to check whether an item should be skipped
|
|
276
289
|
* by the key manager. By default, disabled items are skipped.
|
|
@@ -372,6 +385,14 @@ class ListKeyManager {
|
|
|
372
385
|
});
|
|
373
386
|
return this;
|
|
374
387
|
}
|
|
388
|
+
/**
|
|
389
|
+
* Configures the key manager to focus the first and last items
|
|
390
|
+
* respectively when the Home key and End Key are pressed.
|
|
391
|
+
*/
|
|
392
|
+
withHomeAndEnd() {
|
|
393
|
+
this._homeAndEnd = true;
|
|
394
|
+
return this;
|
|
395
|
+
}
|
|
375
396
|
setActiveItem(item) {
|
|
376
397
|
const previousActiveItem = this._activeItem;
|
|
377
398
|
this.updateActiveItem(item);
|
|
@@ -425,6 +446,22 @@ class ListKeyManager {
|
|
|
425
446
|
else {
|
|
426
447
|
return;
|
|
427
448
|
}
|
|
449
|
+
case HOME:
|
|
450
|
+
if (this._homeAndEnd && isModifierAllowed) {
|
|
451
|
+
this.setFirstItemActive();
|
|
452
|
+
break;
|
|
453
|
+
}
|
|
454
|
+
else {
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
case END:
|
|
458
|
+
if (this._homeAndEnd && isModifierAllowed) {
|
|
459
|
+
this.setLastItemActive();
|
|
460
|
+
break;
|
|
461
|
+
}
|
|
462
|
+
else {
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
428
465
|
default:
|
|
429
466
|
if (isModifierAllowed || hasModifierKey(event, 'shiftKey')) {
|
|
430
467
|
// Attempt to use the `event.key` which also maps it to the user's keyboard language,
|
|
@@ -590,6 +627,17 @@ class FocusKeyManager extends ListKeyManager {
|
|
|
590
627
|
* Use of this source code is governed by an MIT-style license that can be
|
|
591
628
|
* found in the LICENSE file at https://angular.io/license
|
|
592
629
|
*/
|
|
630
|
+
/**
|
|
631
|
+
* Configuration for the isFocusable method.
|
|
632
|
+
*/
|
|
633
|
+
class IsFocusableConfig {
|
|
634
|
+
constructor() {
|
|
635
|
+
/**
|
|
636
|
+
* Whether to count an element as focusable even if it is not currently visible.
|
|
637
|
+
*/
|
|
638
|
+
this.ignoreVisibility = false;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
593
641
|
// The InteractivityChecker leans heavily on the ally.js accessibility utilities.
|
|
594
642
|
// Methods like `isTabbable` are only covering specific edge-cases for the browsers which are
|
|
595
643
|
// supported.
|
|
@@ -637,17 +685,12 @@ class InteractivityChecker {
|
|
|
637
685
|
}
|
|
638
686
|
const frameElement = getFrameElement(getWindow(element));
|
|
639
687
|
if (frameElement) {
|
|
640
|
-
const frameType = frameElement && frameElement.nodeName.toLowerCase();
|
|
641
688
|
// Frame elements inherit their tabindex onto all child elements.
|
|
642
689
|
if (getTabIndexValue(frameElement) === -1) {
|
|
643
690
|
return false;
|
|
644
691
|
}
|
|
645
|
-
//
|
|
646
|
-
if (
|
|
647
|
-
return false;
|
|
648
|
-
}
|
|
649
|
-
// Webkit and Blink disable tabbing to an element inside of an invisible frame.
|
|
650
|
-
if ((this._platform.BLINK || this._platform.WEBKIT) && !this.isVisible(frameElement)) {
|
|
692
|
+
// Browsers disable tabbing to an element inside of an invisible frame.
|
|
693
|
+
if (!this.isVisible(frameElement)) {
|
|
651
694
|
return false;
|
|
652
695
|
}
|
|
653
696
|
}
|
|
@@ -656,38 +699,43 @@ class InteractivityChecker {
|
|
|
656
699
|
if (element.hasAttribute('contenteditable')) {
|
|
657
700
|
return tabIndexValue !== -1;
|
|
658
701
|
}
|
|
659
|
-
if (nodeName === 'iframe') {
|
|
660
|
-
// The
|
|
661
|
-
//
|
|
702
|
+
if (nodeName === 'iframe' || nodeName === 'object') {
|
|
703
|
+
// The frame or object's content may be tabbable depending on the content, but it's
|
|
704
|
+
// not possibly to reliably detect the content of the frames. We always consider such
|
|
705
|
+
// elements as non-tabbable.
|
|
706
|
+
return false;
|
|
707
|
+
}
|
|
708
|
+
// In iOS, the browser only considers some specific elements as tabbable.
|
|
709
|
+
if (this._platform.WEBKIT && this._platform.IOS && !isPotentiallyTabbableIOS(element)) {
|
|
662
710
|
return false;
|
|
663
711
|
}
|
|
664
712
|
if (nodeName === 'audio') {
|
|
713
|
+
// Audio elements without controls enabled are never tabbable, regardless
|
|
714
|
+
// of the tabindex attribute explicitly being set.
|
|
665
715
|
if (!element.hasAttribute('controls')) {
|
|
666
|
-
// By default an <audio> element without the controls enabled is not tabbable.
|
|
667
716
|
return false;
|
|
668
717
|
}
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
}
|
|
718
|
+
// Audio elements with controls are by default tabbable unless the
|
|
719
|
+
// tabindex attribute is set to `-1` explicitly.
|
|
720
|
+
return tabIndexValue !== -1;
|
|
673
721
|
}
|
|
674
722
|
if (nodeName === 'video') {
|
|
675
|
-
if
|
|
676
|
-
|
|
723
|
+
// For all video elements, if the tabindex attribute is set to `-1`, the video
|
|
724
|
+
// is not tabbable. Note: We cannot rely on the default `HTMLElement.tabIndex`
|
|
725
|
+
// property as that one is set to `-1` in Chrome, Edge and Safari v13.1. The
|
|
726
|
+
// tabindex attribute is the source of truth here.
|
|
727
|
+
if (tabIndexValue === -1) {
|
|
677
728
|
return false;
|
|
678
729
|
}
|
|
679
|
-
|
|
680
|
-
|
|
730
|
+
// If the tabindex is explicitly set, and not `-1` (as per check before), the
|
|
731
|
+
// video element is always tabbable (regardless of whether it has controls or not).
|
|
732
|
+
if (tabIndexValue !== null) {
|
|
681
733
|
return true;
|
|
682
734
|
}
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
//
|
|
686
|
-
return
|
|
687
|
-
}
|
|
688
|
-
// In iOS the browser only considers some specific elements as tabbable.
|
|
689
|
-
if (this._platform.WEBKIT && this._platform.IOS && !isPotentiallyTabbableIOS(element)) {
|
|
690
|
-
return false;
|
|
735
|
+
// Otherwise (when no explicit tabindex is set), a video is only tabbable if it
|
|
736
|
+
// has controls enabled. Firefox is special as videos are always tabbable regardless
|
|
737
|
+
// of whether there are controls or not.
|
|
738
|
+
return this._platform.FIREFOX || element.hasAttribute('controls');
|
|
691
739
|
}
|
|
692
740
|
return element.tabIndex >= 0;
|
|
693
741
|
}
|
|
@@ -695,12 +743,14 @@ class InteractivityChecker {
|
|
|
695
743
|
* Gets whether an element can be focused by the user.
|
|
696
744
|
*
|
|
697
745
|
* @param element Element to be checked.
|
|
746
|
+
* @param config The config object with options to customize this method's behavior
|
|
698
747
|
* @returns Whether the element is focusable.
|
|
699
748
|
*/
|
|
700
|
-
isFocusable(element) {
|
|
749
|
+
isFocusable(element, config) {
|
|
701
750
|
// Perform checks in order of left to most expensive.
|
|
702
751
|
// Again, naive approach that does not capture many edge cases and browser quirks.
|
|
703
|
-
return isPotentiallyFocusable(element) && !this.isDisabled(element) &&
|
|
752
|
+
return isPotentiallyFocusable(element) && !this.isDisabled(element) &&
|
|
753
|
+
((config === null || config === void 0 ? void 0 : config.ignoreVisibility) || this.isVisible(element));
|
|
704
754
|
}
|
|
705
755
|
}
|
|
706
756
|
InteractivityChecker.ɵprov = ɵɵdefineInjectable({ factory: function InteractivityChecker_Factory() { return new InteractivityChecker(ɵɵinject(Platform)); }, token: InteractivityChecker, providedIn: "root" });
|
|
@@ -2162,5 +2212,5 @@ A11yModule.ctorParameters = () => [
|
|
|
2162
2212
|
* Generated bundle index. Do not edit.
|
|
2163
2213
|
*/
|
|
2164
2214
|
|
|
2165
|
-
export { A11yModule, ActiveDescendantKeyManager, AriaDescriber, CDK_DESCRIBEDBY_HOST_ATTRIBUTE, CDK_DESCRIBEDBY_ID_PREFIX, CdkAriaLive, CdkMonitorFocus, CdkTrapFocus, ConfigurableFocusTrap, ConfigurableFocusTrapFactory, EventListenerFocusTrapInertStrategy, FOCUS_MONITOR_DEFAULT_OPTIONS, FOCUS_TRAP_INERT_STRATEGY, FocusKeyManager, FocusMonitor, FocusTrap, FocusTrapFactory, HighContrastModeDetector, InteractivityChecker, LIVE_ANNOUNCER_DEFAULT_OPTIONS, LIVE_ANNOUNCER_ELEMENT_TOKEN, LIVE_ANNOUNCER_ELEMENT_TOKEN_FACTORY, ListKeyManager, LiveAnnouncer, MESSAGES_CONTAINER_ID, TOUCH_BUFFER_MS, isFakeMousedownFromScreenReader, FocusTrapManager as ɵangular_material_src_cdk_a11y_a11y_a, ConfigurableFocusTrapConfig as ɵangular_material_src_cdk_a11y_a11y_b };
|
|
2215
|
+
export { A11yModule, ActiveDescendantKeyManager, AriaDescriber, CDK_DESCRIBEDBY_HOST_ATTRIBUTE, CDK_DESCRIBEDBY_ID_PREFIX, CdkAriaLive, CdkMonitorFocus, CdkTrapFocus, ConfigurableFocusTrap, ConfigurableFocusTrapFactory, EventListenerFocusTrapInertStrategy, FOCUS_MONITOR_DEFAULT_OPTIONS, FOCUS_TRAP_INERT_STRATEGY, FocusKeyManager, FocusMonitor, FocusTrap, FocusTrapFactory, HighContrastModeDetector, InteractivityChecker, IsFocusableConfig, LIVE_ANNOUNCER_DEFAULT_OPTIONS, LIVE_ANNOUNCER_ELEMENT_TOKEN, LIVE_ANNOUNCER_ELEMENT_TOKEN_FACTORY, ListKeyManager, LiveAnnouncer, MESSAGES_CONTAINER_ID, TOUCH_BUFFER_MS, isFakeMousedownFromScreenReader, FocusTrapManager as ɵangular_material_src_cdk_a11y_a11y_a, ConfigurableFocusTrapConfig as ɵangular_material_src_cdk_a11y_a11y_b };
|
|
2166
2216
|
//# sourceMappingURL=a11y.js.map
|