@angular/cdk 9.2.0 → 9.2.1

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.
Files changed (63) hide show
  1. package/a11y/focus-monitor/focus-monitor.d.ts +6 -0
  2. package/a11y/index.metadata.json +1 -1
  3. package/bundles/cdk-a11y.umd.js +71 -64
  4. package/bundles/cdk-a11y.umd.js.map +1 -1
  5. package/bundles/cdk-a11y.umd.min.js +8 -8
  6. package/bundles/cdk-a11y.umd.min.js.map +1 -1
  7. package/bundles/cdk-drag-drop.umd.js +108 -79
  8. package/bundles/cdk-drag-drop.umd.js.map +1 -1
  9. package/bundles/cdk-drag-drop.umd.min.js +15 -8
  10. package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
  11. package/bundles/cdk-tree.umd.js +8 -4
  12. package/bundles/cdk-tree.umd.js.map +1 -1
  13. package/bundles/cdk-tree.umd.min.js +1 -1
  14. package/bundles/cdk-tree.umd.min.js.map +1 -1
  15. package/bundles/cdk.umd.js +1 -1
  16. package/bundles/cdk.umd.js.map +1 -1
  17. package/bundles/cdk.umd.min.js +1 -1
  18. package/bundles/cdk.umd.min.js.map +1 -1
  19. package/drag-drop/client-rect.d.ts +31 -0
  20. package/drag-drop/directives/config.d.ts +1 -0
  21. package/drag-drop/directives/drop-list.d.ts +4 -3
  22. package/drag-drop/drag-ref.d.ts +4 -0
  23. package/drag-drop/index.metadata.json +1 -1
  24. package/esm2015/a11y/focus-monitor/focus-monitor.js +71 -65
  25. package/esm2015/a11y/high-contrast-mode/high-contrast-mode-detector.js +8 -4
  26. package/esm2015/drag-drop/client-rect.js +75 -0
  27. package/esm2015/drag-drop/directives/config.js +3 -1
  28. package/esm2015/drag-drop/directives/drag.js +3 -2
  29. package/esm2015/drag-drop/directives/drop-list.js +24 -18
  30. package/esm2015/drag-drop/drag-ref.js +55 -21
  31. package/esm2015/drag-drop/drop-list-ref.js +5 -64
  32. package/esm2015/tree/padding.js +9 -10
  33. package/esm2015/version.js +1 -1
  34. package/esm5/a11y/focus-monitor/focus-monitor.js +49 -44
  35. package/esm5/a11y/high-contrast-mode/high-contrast-mode-detector.js +7 -4
  36. package/esm5/drag-drop/client-rect.js +60 -0
  37. package/esm5/drag-drop/directives/config.js +1 -1
  38. package/esm5/drag-drop/directives/drag.js +3 -2
  39. package/esm5/drag-drop/directives/drop-list.js +13 -10
  40. package/esm5/drag-drop/drag-ref.js +33 -17
  41. package/esm5/drag-drop/drop-list-ref.js +5 -54
  42. package/esm5/tree/padding.js +9 -5
  43. package/esm5/version.js +1 -1
  44. package/fesm2015/a11y.js +101 -92
  45. package/fesm2015/a11y.js.map +1 -1
  46. package/fesm2015/cdk.js +1 -1
  47. package/fesm2015/cdk.js.map +1 -1
  48. package/fesm2015/drag-drop.js +158 -101
  49. package/fesm2015/drag-drop.js.map +1 -1
  50. package/fesm2015/tree.js +8 -9
  51. package/fesm2015/tree.js.map +1 -1
  52. package/fesm5/a11y.js +71 -64
  53. package/fesm5/a11y.js.map +1 -1
  54. package/fesm5/cdk.js +1 -1
  55. package/fesm5/cdk.js.map +1 -1
  56. package/fesm5/drag-drop.js +108 -79
  57. package/fesm5/drag-drop.js.map +1 -1
  58. package/fesm5/tree.js +8 -4
  59. package/fesm5/tree.js.map +1 -1
  60. package/package.json +1 -1
  61. package/schematics/ng-add/index.js +1 -1
  62. package/tree/index.metadata.json +1 -1
  63. package/tree/padding.d.ts +6 -2
package/fesm2015/cdk.js CHANGED
@@ -8,7 +8,7 @@ import { Version } from '@angular/core';
8
8
  * found in the LICENSE file at https://angular.io/license
9
9
  */
10
10
  /** Current version of the Angular Component Development Kit. */
11
- const VERSION = new Version('9.2.0');
11
+ const VERSION = new Version('9.2.1');
12
12
 
13
13
  /**
14
14
  * @license
@@ -1 +1 @@
1
- {"version":3,"file":"cdk.js","sources":["../../../../../../src/cdk/version.ts","../../../../../../src/cdk/public-api.ts","../../../../../../src/cdk/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('9.2.0');\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './version';\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAAA;;;;;;;AAQA,AAEA;AACA,MAAa,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB,CAAC;;ACXvD;;;;;;GAMG;;ACNH;;;;;;GAMG;;;;"}
1
+ {"version":3,"file":"cdk.js","sources":["../../../../../../src/cdk/version.ts","../../../../../../src/cdk/public-api.ts","../../../../../../src/cdk/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('9.2.1');\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './version';\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAAA;;;;;;;AAQA,AAEA;AACA,MAAa,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB,CAAC;;ACXvD;;;;;;GAMG;;ACNH;;;;;;GAMG;;;;"}
@@ -137,6 +137,81 @@ function parseCssPropertyValue(computedStyle, name) {
137
137
  part => part.trim()));
138
138
  }
139
139
 
140
+ /**
141
+ * @fileoverview added by tsickle
142
+ * Generated from: src/cdk/drag-drop/client-rect.ts
143
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
144
+ */
145
+ /**
146
+ * @license
147
+ * Copyright Google LLC All Rights Reserved.
148
+ *
149
+ * Use of this source code is governed by an MIT-style license that can be
150
+ * found in the LICENSE file at https://angular.io/license
151
+ */
152
+ /**
153
+ * Gets a mutable version of an element's bounding `ClientRect`.
154
+ * @param {?} element
155
+ * @return {?}
156
+ */
157
+ function getMutableClientRect(element) {
158
+ /** @type {?} */
159
+ const clientRect = element.getBoundingClientRect();
160
+ // We need to clone the `clientRect` here, because all the values on it are readonly
161
+ // and we need to be able to update them. Also we can't use a spread here, because
162
+ // the values on a `ClientRect` aren't own properties. See:
163
+ // https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect#Notes
164
+ return {
165
+ top: clientRect.top,
166
+ right: clientRect.right,
167
+ bottom: clientRect.bottom,
168
+ left: clientRect.left,
169
+ width: clientRect.width,
170
+ height: clientRect.height
171
+ };
172
+ }
173
+ /**
174
+ * Checks whether some coordinates are within a `ClientRect`.
175
+ * @param {?} clientRect ClientRect that is being checked.
176
+ * @param {?} x Coordinates along the X axis.
177
+ * @param {?} y Coordinates along the Y axis.
178
+ * @return {?}
179
+ */
180
+ function isInsideClientRect(clientRect, x, y) {
181
+ const { top, bottom, left, right } = clientRect;
182
+ return y >= top && y <= bottom && x >= left && x <= right;
183
+ }
184
+ /**
185
+ * Updates the top/left positions of a `ClientRect`, as well as their bottom/right counterparts.
186
+ * @param {?} clientRect `ClientRect` that should be updated.
187
+ * @param {?} top Amount to add to the `top` position.
188
+ * @param {?} left Amount to add to the `left` position.
189
+ * @return {?}
190
+ */
191
+ function adjustClientRect(clientRect, top, left) {
192
+ clientRect.top += top;
193
+ clientRect.bottom = clientRect.top + clientRect.height;
194
+ clientRect.left += left;
195
+ clientRect.right = clientRect.left + clientRect.width;
196
+ }
197
+ /**
198
+ * Checks whether the pointer coordinates are close to a ClientRect.
199
+ * @param {?} rect ClientRect to check against.
200
+ * @param {?} threshold Threshold around the ClientRect.
201
+ * @param {?} pointerX Coordinates along the X axis.
202
+ * @param {?} pointerY Coordinates along the Y axis.
203
+ * @return {?}
204
+ */
205
+ function isPointerNearClientRect(rect, threshold, pointerX, pointerY) {
206
+ const { top, right, bottom, left, width, height } = rect;
207
+ /** @type {?} */
208
+ const xThreshold = width * threshold;
209
+ /** @type {?} */
210
+ const yThreshold = height * threshold;
211
+ return pointerY > top - yThreshold && pointerY < bottom + yThreshold &&
212
+ pointerX > left - xThreshold && pointerX < right + xThreshold;
213
+ }
214
+
140
215
  /**
141
216
  * @fileoverview added by tsickle
142
217
  * Generated from: src/cdk/drag-drop/drag-ref.ts
@@ -160,6 +235,11 @@ if (false) {
160
235
  * @type {?}
161
236
  */
162
237
  DragRefConfig.prototype.pointerDirectionChangeThreshold;
238
+ /**
239
+ * `z-index` for the absolutely-positioned elements that are created by the drag item.
240
+ * @type {?|undefined}
241
+ */
242
+ DragRefConfig.prototype.zIndex;
163
243
  }
164
244
  /**
165
245
  * Options that can be used to bind a passive event listener.
@@ -370,9 +450,9 @@ class DragRef {
370
450
  // Prevent the default action as early as possible in order to block
371
451
  // native actions like dragging the selected text or images with the mouse.
372
452
  event.preventDefault();
453
+ /** @type {?} */
454
+ const pointerPosition = this._getPointerPositionOnPage(event);
373
455
  if (!this._hasStartedDragging) {
374
- /** @type {?} */
375
- const pointerPosition = this._getPointerPositionOnPage(event);
376
456
  /** @type {?} */
377
457
  const distanceX = Math.abs(pointerPosition.x - this._pickupPositionOnPage.x);
378
458
  /** @type {?} */
@@ -412,7 +492,7 @@ class DragRef {
412
492
  }
413
493
  }
414
494
  /** @type {?} */
415
- const constrainedPointerPosition = this._getConstrainedPointerPosition(event);
495
+ const constrainedPointerPosition = this._getConstrainedPointerPosition(pointerPosition);
416
496
  this._hasMoved = true;
417
497
  this._updatePointerDirectionDelta(constrainedPointerPosition);
418
498
  if (this._dropContainer) {
@@ -565,8 +645,13 @@ class DragRef {
565
645
  if ((/** @type {?} */ (this))._rootElement) {
566
646
  (/** @type {?} */ (this))._removeRootElementListeners((/** @type {?} */ (this))._rootElement);
567
647
  }
568
- element.addEventListener('mousedown', (/** @type {?} */ (this))._pointerDown, activeEventListenerOptions);
569
- element.addEventListener('touchstart', (/** @type {?} */ (this))._pointerDown, passiveEventListenerOptions);
648
+ (/** @type {?} */ (this))._ngZone.runOutsideAngular((/**
649
+ * @return {?}
650
+ */
651
+ () => {
652
+ element.addEventListener('mousedown', (/** @type {?} */ (this))._pointerDown, activeEventListenerOptions);
653
+ element.addEventListener('touchstart', (/** @type {?} */ (this))._pointerDown, passiveEventListenerOptions);
654
+ }));
570
655
  (/** @type {?} */ (this))._initialTransform = undefined;
571
656
  (/** @type {?} */ (this))._rootElement = element;
572
657
  }
@@ -711,7 +796,7 @@ class DragRef {
711
796
  /** @type {?} */
712
797
  const position = this._pointerPositionAtLastDirectionChange;
713
798
  if (position && this._dropContainer) {
714
- this._updateActiveDropContainer(position);
799
+ this._updateActiveDropContainer(this._getConstrainedPointerPosition(position));
715
800
  }
716
801
  }
717
802
  /**
@@ -901,10 +986,10 @@ class DragRef {
901
986
  * @return {?}
902
987
  */
903
988
  () => {
904
- this._scrollPosition = this._viewportRuler.getViewportScrollPosition();
989
+ this._updateOnScroll();
905
990
  }));
906
991
  if (this._boundaryElement) {
907
- this._boundaryRect = this._boundaryElement.getBoundingClientRect();
992
+ this._boundaryRect = getMutableClientRect(this._boundaryElement);
908
993
  }
909
994
  // If we have a custom preview we can't know ahead of time how large it'll be so we position
910
995
  // it next to the cursor. The exception is when the consumer has opted into making the preview
@@ -1055,7 +1140,7 @@ class DragRef {
1055
1140
  position: 'fixed',
1056
1141
  top: '0',
1057
1142
  left: '0',
1058
- zIndex: '1000'
1143
+ zIndex: `${this._config.zIndex || 1000}`
1059
1144
  });
1060
1145
  toggleNativeDragInteractions(preview, false);
1061
1146
  preview.classList.add('cdk-drag-preview');
@@ -1195,12 +1280,10 @@ class DragRef {
1195
1280
  /**
1196
1281
  * Gets the pointer position on the page, accounting for any position constraints.
1197
1282
  * @private
1198
- * @param {?} event
1283
+ * @param {?} point
1199
1284
  * @return {?}
1200
1285
  */
1201
- _getConstrainedPointerPosition(event) {
1202
- /** @type {?} */
1203
- const point = this._getPointerPositionOnPage(event);
1286
+ _getConstrainedPointerPosition(point) {
1204
1287
  /** @type {?} */
1205
1288
  const constrainedPoint = this.constrainPosition ? this.constrainPosition(point, this) : point;
1206
1289
  /** @type {?} */
@@ -1406,6 +1489,27 @@ class DragRef {
1406
1489
  }
1407
1490
  return value ? value.mouse : 0;
1408
1491
  }
1492
+ /**
1493
+ * Updates the internal state of the draggable element when scrolling has occurred.
1494
+ * @private
1495
+ * @return {?}
1496
+ */
1497
+ _updateOnScroll() {
1498
+ /** @type {?} */
1499
+ const oldScrollPosition = this._scrollPosition;
1500
+ /** @type {?} */
1501
+ const currentScrollPosition = this._viewportRuler.getViewportScrollPosition();
1502
+ // ClientRect dimensions are based on the page's scroll position so
1503
+ // we have to update the cached boundary ClientRect if the user has scrolled.
1504
+ if (oldScrollPosition && this._boundaryRect) {
1505
+ /** @type {?} */
1506
+ const topDifference = oldScrollPosition.top - currentScrollPosition.top;
1507
+ /** @type {?} */
1508
+ const leftDifference = oldScrollPosition.left - currentScrollPosition.left;
1509
+ adjustClientRect(this._boundaryRect, topDifference, leftDifference);
1510
+ }
1511
+ this._scrollPosition = currentScrollPosition;
1512
+ }
1409
1513
  }
1410
1514
  if (false) {
1411
1515
  /**
@@ -1850,14 +1954,18 @@ function getPreviewInsertionPoint(documentRef) {
1850
1954
  */
1851
1955
  function getRootNode(viewRef, _document) {
1852
1956
  /** @type {?} */
1853
- const rootNode = viewRef.rootNodes[0];
1854
- if (rootNode.nodeType !== _document.ELEMENT_NODE) {
1855
- /** @type {?} */
1856
- const wrapper = _document.createElement('div');
1857
- wrapper.appendChild(rootNode);
1858
- return wrapper;
1957
+ const rootNodes = viewRef.rootNodes;
1958
+ if (rootNodes.length === 1 && rootNodes[0].nodeType === _document.ELEMENT_NODE) {
1959
+ return (/** @type {?} */ (rootNodes[0]));
1859
1960
  }
1860
- return (/** @type {?} */ (rootNode));
1961
+ /** @type {?} */
1962
+ const wrapper = _document.createElement('div');
1963
+ rootNodes.forEach((/**
1964
+ * @param {?} node
1965
+ * @return {?}
1966
+ */
1967
+ node => wrapper.appendChild(node)));
1968
+ return wrapper;
1861
1969
  }
1862
1970
  /**
1863
1971
  * Matches the target element's size to the source's size.
@@ -2431,7 +2539,8 @@ class DropListRef {
2431
2539
  */
2432
2540
  _sortItem(item, pointerX, pointerY, pointerDelta) {
2433
2541
  // Don't sort the item if sorting is disabled or it's out of range.
2434
- if (this.sortingDisabled || !isPointerNearClientRect(this._clientRect, pointerX, pointerY)) {
2542
+ if (this.sortingDisabled ||
2543
+ !isPointerNearClientRect(this._clientRect, DROP_PROXIMITY_THRESHOLD, pointerX, pointerY)) {
2435
2544
  return;
2436
2545
  }
2437
2546
  /** @type {?} */
@@ -2541,7 +2650,7 @@ class DropListRef {
2541
2650
  if (element === this._document || !position.clientRect || scrollNode) {
2542
2651
  return;
2543
2652
  }
2544
- if (isPointerNearClientRect(position.clientRect, pointerX, pointerY)) {
2653
+ if (isPointerNearClientRect(position.clientRect, DROP_PROXIMITY_THRESHOLD, pointerX, pointerY)) {
2545
2654
  [verticalScrollDirection, horizontalScrollDirection] = getElementScrollDirections((/** @type {?} */ (element)), position.clientRect, pointerX, pointerY);
2546
2655
  if (verticalScrollDirection || horizontalScrollDirection) {
2547
2656
  scrollNode = (/** @type {?} */ (element));
@@ -3167,35 +3276,6 @@ if (false) {
3167
3276
  */
3168
3277
  DropListRef.prototype._viewportRuler;
3169
3278
  }
3170
- /**
3171
- * Updates the top/left positions of a `ClientRect`, as well as their bottom/right counterparts.
3172
- * @param {?} clientRect `ClientRect` that should be updated.
3173
- * @param {?} top Amount to add to the `top` position.
3174
- * @param {?} left Amount to add to the `left` position.
3175
- * @return {?}
3176
- */
3177
- function adjustClientRect(clientRect, top, left) {
3178
- clientRect.top += top;
3179
- clientRect.bottom = clientRect.top + clientRect.height;
3180
- clientRect.left += left;
3181
- clientRect.right = clientRect.left + clientRect.width;
3182
- }
3183
- /**
3184
- * Checks whether the pointer coordinates are close to a ClientRect.
3185
- * @param {?} rect ClientRect to check against.
3186
- * @param {?} pointerX Coordinates along the X axis.
3187
- * @param {?} pointerY Coordinates along the Y axis.
3188
- * @return {?}
3189
- */
3190
- function isPointerNearClientRect(rect, pointerX, pointerY) {
3191
- const { top, right, bottom, left, width, height } = rect;
3192
- /** @type {?} */
3193
- const xThreshold = width * DROP_PROXIMITY_THRESHOLD;
3194
- /** @type {?} */
3195
- const yThreshold = height * DROP_PROXIMITY_THRESHOLD;
3196
- return pointerY > top - yThreshold && pointerY < bottom + yThreshold &&
3197
- pointerX > left - xThreshold && pointerX < right + xThreshold;
3198
- }
3199
3279
  /**
3200
3280
  * Finds the index of an item that matches a predicate function. Used as an equivalent
3201
3281
  * of `Array.prototype.findIndex` which isn't part of the standard Google typings.
@@ -3212,38 +3292,6 @@ function findIndex(array, predicate) {
3212
3292
  }
3213
3293
  return -1;
3214
3294
  }
3215
- /**
3216
- * Checks whether some coordinates are within a `ClientRect`.
3217
- * @param {?} clientRect ClientRect that is being checked.
3218
- * @param {?} x Coordinates along the X axis.
3219
- * @param {?} y Coordinates along the Y axis.
3220
- * @return {?}
3221
- */
3222
- function isInsideClientRect(clientRect, x, y) {
3223
- const { top, bottom, left, right } = clientRect;
3224
- return y >= top && y <= bottom && x >= left && x <= right;
3225
- }
3226
- /**
3227
- * Gets a mutable version of an element's bounding `ClientRect`.
3228
- * @param {?} element
3229
- * @return {?}
3230
- */
3231
- function getMutableClientRect(element) {
3232
- /** @type {?} */
3233
- const clientRect = element.getBoundingClientRect();
3234
- // We need to clone the `clientRect` here, because all the values on it are readonly
3235
- // and we need to be able to update them. Also we can't use a spread here, because
3236
- // the values on a `ClientRect` aren't own properties. See:
3237
- // https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect#Notes
3238
- return {
3239
- top: clientRect.top,
3240
- right: clientRect.right,
3241
- bottom: clientRect.bottom,
3242
- left: clientRect.left,
3243
- width: clientRect.width,
3244
- height: clientRect.height
3245
- };
3246
- }
3247
3295
  /**
3248
3296
  * Increments the vertical scroll position of a node.
3249
3297
  * @param {?} node Node whose scroll position should change.
@@ -4201,6 +4249,8 @@ if (false) {
4201
4249
  DragDropConfig.prototype.listAutoScrollDisabled;
4202
4250
  /** @type {?|undefined} */
4203
4251
  DragDropConfig.prototype.listOrientation;
4252
+ /** @type {?|undefined} */
4253
+ DragDropConfig.prototype.zIndex;
4204
4254
  }
4205
4255
  /**
4206
4256
  * @deprecated No longer being used. To be removed.
@@ -4304,7 +4354,8 @@ class CdkDrag {
4304
4354
  dragStartThreshold: config && config.dragStartThreshold != null ?
4305
4355
  config.dragStartThreshold : 5,
4306
4356
  pointerDirectionChangeThreshold: config && config.pointerDirectionChangeThreshold != null ?
4307
- config.pointerDirectionChangeThreshold : 5
4357
+ config.pointerDirectionChangeThreshold : 5,
4358
+ zIndex: config === null || config === void 0 ? void 0 : config.zIndex
4308
4359
  });
4309
4360
  this._dragRef.data = this;
4310
4361
  if (config) {
@@ -5051,23 +5102,6 @@ class CdkDropList {
5051
5102
  // the user in a disabled state, so we also need to sync it as it's being set.
5052
5103
  this._dropListRef.disabled = this._disabled = coerceBooleanProperty(value);
5053
5104
  }
5054
- /**
5055
- * @return {?}
5056
- */
5057
- ngAfterContentInit() {
5058
- // @breaking-change 11.0.0 Remove null check for _scrollDispatcher once it's required.
5059
- if (this._scrollDispatcher) {
5060
- /** @type {?} */
5061
- const scrollableParents = this._scrollDispatcher
5062
- .getAncestorScrollContainers(this.element)
5063
- .map((/**
5064
- * @param {?} scrollable
5065
- * @return {?}
5066
- */
5067
- scrollable => scrollable.getElementRef().nativeElement));
5068
- this._dropListRef.withScrollableParents(scrollableParents);
5069
- }
5070
- }
5071
5105
  /**
5072
5106
  * Registers an items with the drop list.
5073
5107
  * @param {?} item
@@ -5226,6 +5260,23 @@ class CdkDropList {
5226
5260
  }
5227
5261
  }));
5228
5262
  }
5263
+ // Note that we resolve the scrollable parents here so that we delay the resolution
5264
+ // as long as possible, ensuring that the element is in its final place in the DOM.
5265
+ // @breaking-change 11.0.0 Remove null check for _scrollDispatcher once it's required.
5266
+ if (!this._scrollableParentsResolved && this._scrollDispatcher) {
5267
+ /** @type {?} */
5268
+ const scrollableParents = this._scrollDispatcher
5269
+ .getAncestorScrollContainers(this.element)
5270
+ .map((/**
5271
+ * @param {?} scrollable
5272
+ * @return {?}
5273
+ */
5274
+ scrollable => scrollable.getElementRef().nativeElement));
5275
+ this._dropListRef.withScrollableParents(scrollableParents);
5276
+ // Only do this once since it involves traversing the DOM and the parents
5277
+ // shouldn't be able to change without the drop list being destroyed.
5278
+ this._scrollableParentsResolved = true;
5279
+ }
5229
5280
  ref.disabled = this.disabled;
5230
5281
  ref.lockAxis = this.lockAxis;
5231
5282
  ref.sortingDisabled = coerceBooleanProperty(this.sortingDisabled);
@@ -5405,6 +5456,12 @@ if (false) {
5405
5456
  * @private
5406
5457
  */
5407
5458
  CdkDropList.prototype._destroyed;
5459
+ /**
5460
+ * Whether the element's scrollable parents have been resolved.
5461
+ * @type {?}
5462
+ * @private
5463
+ */
5464
+ CdkDropList.prototype._scrollableParentsResolved;
5408
5465
  /**
5409
5466
  * Reference to the underlying drop list instance.
5410
5467
  * @type {?}