@angular/cdk 14.1.0-next.2 → 14.1.0
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/index.d.ts +14 -8
- package/bidi/index.d.ts +1 -1
- package/clipboard/index.d.ts +2 -2
- package/collections/index.d.ts +28 -7
- package/drag-drop/index.d.ts +2 -2
- package/esm2020/a11y/focus-monitor/focus-monitor.mjs +45 -4
- package/esm2020/a11y/live-announcer/live-announcer.mjs +1 -1
- package/esm2020/bidi/dir-document-token.mjs +2 -2
- package/esm2020/clipboard/pending-copy.mjs +5 -3
- package/esm2020/collections/selection-model.mjs +41 -8
- package/esm2020/drag-drop/directives/drag.mjs +1 -1
- package/esm2020/drag-drop/drag-drop-registry.mjs +2 -2
- package/esm2020/drag-drop/drag-ref.mjs +2 -2
- package/esm2020/drag-drop/sorting/single-axis-sort-strategy.mjs +2 -2
- package/esm2020/menu/menu-item-radio.mjs +2 -2
- package/esm2020/overlay/overlay-config.mjs +2 -2
- package/esm2020/overlay/position/flexible-connected-position-strategy.mjs +6 -6
- package/esm2020/scrolling/scroll-dispatcher.mjs +2 -2
- package/esm2020/stepper/stepper.mjs +3 -3
- package/esm2020/table/sticky-position-listener.mjs +1 -1
- package/esm2020/table/table-errors.mjs +2 -2
- package/esm2020/table/table.mjs +3 -3
- package/esm2020/version.mjs +1 -1
- package/fesm2015/a11y.mjs +44 -3
- package/fesm2015/a11y.mjs.map +1 -1
- package/fesm2015/bidi.mjs +1 -1
- package/fesm2015/bidi.mjs.map +1 -1
- package/fesm2015/cdk.mjs +1 -1
- package/fesm2015/cdk.mjs.map +1 -1
- package/fesm2015/clipboard.mjs +4 -2
- package/fesm2015/clipboard.mjs.map +1 -1
- package/fesm2015/collections.mjs +40 -7
- package/fesm2015/collections.mjs.map +1 -1
- package/fesm2015/drag-drop.mjs +3 -3
- package/fesm2015/drag-drop.mjs.map +1 -1
- package/fesm2015/menu.mjs +1 -1
- package/fesm2015/menu.mjs.map +1 -1
- package/fesm2015/overlay.mjs +6 -6
- package/fesm2015/overlay.mjs.map +1 -1
- package/fesm2015/scrolling.mjs +1 -1
- package/fesm2015/scrolling.mjs.map +1 -1
- package/fesm2015/stepper.mjs +2 -2
- package/fesm2015/stepper.mjs.map +1 -1
- package/fesm2015/table.mjs +3 -3
- package/fesm2015/table.mjs.map +1 -1
- package/fesm2020/a11y.mjs +44 -3
- package/fesm2020/a11y.mjs.map +1 -1
- package/fesm2020/bidi.mjs +1 -1
- package/fesm2020/bidi.mjs.map +1 -1
- package/fesm2020/cdk.mjs +1 -1
- package/fesm2020/cdk.mjs.map +1 -1
- package/fesm2020/clipboard.mjs +4 -2
- package/fesm2020/clipboard.mjs.map +1 -1
- package/fesm2020/collections.mjs +40 -7
- package/fesm2020/collections.mjs.map +1 -1
- package/fesm2020/drag-drop.mjs +3 -3
- package/fesm2020/drag-drop.mjs.map +1 -1
- package/fesm2020/menu.mjs +1 -1
- package/fesm2020/menu.mjs.map +1 -1
- package/fesm2020/overlay.mjs +6 -6
- package/fesm2020/overlay.mjs.map +1 -1
- package/fesm2020/scrolling.mjs +1 -1
- package/fesm2020/scrolling.mjs.map +1 -1
- package/fesm2020/stepper.mjs +2 -2
- package/fesm2020/stepper.mjs.map +1 -1
- package/fesm2020/table.mjs +3 -3
- package/fesm2020/table.mjs.map +1 -1
- package/menu/index.d.ts +1 -1
- package/overlay/index.d.ts +3 -3
- package/package.json +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/scrolling/index.d.ts +1 -1
- package/table/index.d.ts +4 -4
package/fesm2020/a11y.mjs
CHANGED
|
@@ -1947,10 +1947,14 @@ class FocusMonitor {
|
|
|
1947
1947
|
*/
|
|
1948
1948
|
this._rootNodeFocusAndBlurListener = (event) => {
|
|
1949
1949
|
const target = _getEventTarget(event);
|
|
1950
|
-
const handler = event.type === 'focus' ? this._onFocus : this._onBlur;
|
|
1951
1950
|
// We need to walk up the ancestor chain in order to support `checkChildren`.
|
|
1952
1951
|
for (let element = target; element; element = element.parentElement) {
|
|
1953
|
-
|
|
1952
|
+
if (event.type === 'focus') {
|
|
1953
|
+
this._onFocus(event, element);
|
|
1954
|
+
}
|
|
1955
|
+
else {
|
|
1956
|
+
this._onBlur(event, element);
|
|
1957
|
+
}
|
|
1954
1958
|
}
|
|
1955
1959
|
};
|
|
1956
1960
|
this._document = document;
|
|
@@ -2046,7 +2050,17 @@ class FocusMonitor {
|
|
|
2046
2050
|
// events).
|
|
2047
2051
|
//
|
|
2048
2052
|
// Because we can't distinguish between these two cases, we default to setting `program`.
|
|
2049
|
-
|
|
2053
|
+
if (this._windowFocused && this._lastFocusOrigin) {
|
|
2054
|
+
return this._lastFocusOrigin;
|
|
2055
|
+
}
|
|
2056
|
+
// If the interaction is coming from an input label, we consider it a mouse interactions.
|
|
2057
|
+
// This is a special case where focus moves on `click`, rather than `mousedown` which breaks
|
|
2058
|
+
// our detection, because all our assumptions are for `mousedown`. We need to handle this
|
|
2059
|
+
// special case, because it's very common for checkboxes and radio buttons.
|
|
2060
|
+
if (focusEventTarget && this._isLastInteractionFromInputLabel(focusEventTarget)) {
|
|
2061
|
+
return 'mouse';
|
|
2062
|
+
}
|
|
2063
|
+
return 'program';
|
|
2050
2064
|
}
|
|
2051
2065
|
/**
|
|
2052
2066
|
* Returns whether the focus event should be attributed to touch. Recall that in IMMEDIATE mode, a
|
|
@@ -2220,6 +2234,33 @@ class FocusMonitor {
|
|
|
2220
2234
|
});
|
|
2221
2235
|
return results;
|
|
2222
2236
|
}
|
|
2237
|
+
/**
|
|
2238
|
+
* Returns whether an interaction is likely to have come from the user clicking the `label` of
|
|
2239
|
+
* an `input` or `textarea` in order to focus it.
|
|
2240
|
+
* @param focusEventTarget Target currently receiving focus.
|
|
2241
|
+
*/
|
|
2242
|
+
_isLastInteractionFromInputLabel(focusEventTarget) {
|
|
2243
|
+
const { _mostRecentTarget: mostRecentTarget, mostRecentModality } = this._inputModalityDetector;
|
|
2244
|
+
// If the last interaction used the mouse on an element contained by one of the labels
|
|
2245
|
+
// of an `input`/`textarea` that is currently focused, it is very likely that the
|
|
2246
|
+
// user redirected focus using the label.
|
|
2247
|
+
if (mostRecentModality !== 'mouse' ||
|
|
2248
|
+
!mostRecentTarget ||
|
|
2249
|
+
mostRecentTarget === focusEventTarget ||
|
|
2250
|
+
(focusEventTarget.nodeName !== 'INPUT' && focusEventTarget.nodeName !== 'TEXTAREA') ||
|
|
2251
|
+
focusEventTarget.disabled) {
|
|
2252
|
+
return false;
|
|
2253
|
+
}
|
|
2254
|
+
const labels = focusEventTarget.labels;
|
|
2255
|
+
if (labels) {
|
|
2256
|
+
for (let i = 0; i < labels.length; i++) {
|
|
2257
|
+
if (labels[i].contains(mostRecentTarget)) {
|
|
2258
|
+
return true;
|
|
2259
|
+
}
|
|
2260
|
+
}
|
|
2261
|
+
}
|
|
2262
|
+
return false;
|
|
2263
|
+
}
|
|
2223
2264
|
}
|
|
2224
2265
|
FocusMonitor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: FocusMonitor, deps: [{ token: i0.NgZone }, { token: i1.Platform }, { token: InputModalityDetector }, { token: DOCUMENT, optional: true }, { token: FOCUS_MONITOR_DEFAULT_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2225
2266
|
FocusMonitor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: FocusMonitor, providedIn: 'root' });
|