@angular/cdk 12.2.9 → 12.2.13

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/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('12.2.9');
11
+ const VERSION = new Version('12.2.13');
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('12.2.9');\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;;;;;;;AAUA;MACa,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB;;ACXtD;;;;;;;;ACAA;;;;;;;;;;"}
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('12.2.13');\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;;;;;;;AAUA;MACa,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB;;ACXtD;;;;;;;;ACAA;;;;;;;;;;"}
@@ -596,9 +596,24 @@ class OverlayOutsideClickDispatcher extends BaseOverlayDispatcher {
596
596
  super(document);
597
597
  this._platform = _platform;
598
598
  this._cursorStyleIsSet = false;
599
+ /** Store pointerdown event target to track origin of click. */
600
+ this._pointerDownListener = (event) => {
601
+ this._pointerDownEventTarget = _getEventTarget(event);
602
+ };
599
603
  /** Click event listener that will be attached to the body propagate phase. */
600
604
  this._clickListener = (event) => {
601
605
  const target = _getEventTarget(event);
606
+ // In case of a click event, we want to check the origin of the click
607
+ // (e.g. in case where a user starts a click inside the overlay and
608
+ // releases the click outside of it).
609
+ // This is done by using the event target of the preceding pointerdown event.
610
+ // Every click event caused by a pointer device has a preceding pointerdown
611
+ // event, unless the click was programmatically triggered (e.g. in a unit test).
612
+ const origin = event.type === 'click' && this._pointerDownEventTarget
613
+ ? this._pointerDownEventTarget : target;
614
+ // Reset the stored pointerdown event target, to avoid having it interfere
615
+ // in subsequent events.
616
+ this._pointerDownEventTarget = null;
602
617
  // We copy the array because the original may be modified asynchronously if the
603
618
  // outsidePointerEvents listener decides to detach overlays resulting in index errors inside
604
619
  // the for loop.
@@ -613,8 +628,10 @@ class OverlayOutsideClickDispatcher extends BaseOverlayDispatcher {
613
628
  continue;
614
629
  }
615
630
  // If it's a click inside the overlay, just break - we should do nothing
616
- // If it's an outside click dispatch the mouse event, and proceed with the next overlay
617
- if (overlayRef.overlayElement.contains(target)) {
631
+ // If it's an outside click (both origin and target of the click) dispatch the mouse event,
632
+ // and proceed with the next overlay
633
+ if (overlayRef.overlayElement.contains(target) ||
634
+ overlayRef.overlayElement.contains(origin)) {
618
635
  break;
619
636
  }
620
637
  overlayRef._outsidePointerEvents.next(event);
@@ -632,6 +649,7 @@ class OverlayOutsideClickDispatcher extends BaseOverlayDispatcher {
632
649
  // https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html
633
650
  if (!this._isAttached) {
634
651
  const body = this._document.body;
652
+ body.addEventListener('pointerdown', this._pointerDownListener, true);
635
653
  body.addEventListener('click', this._clickListener, true);
636
654
  body.addEventListener('auxclick', this._clickListener, true);
637
655
  body.addEventListener('contextmenu', this._clickListener, true);
@@ -649,6 +667,7 @@ class OverlayOutsideClickDispatcher extends BaseOverlayDispatcher {
649
667
  detach() {
650
668
  if (this._isAttached) {
651
669
  const body = this._document.body;
670
+ body.removeEventListener('pointerdown', this._pointerDownListener, true);
652
671
  body.removeEventListener('click', this._clickListener, true);
653
672
  body.removeEventListener('auxclick', this._clickListener, true);
654
673
  body.removeEventListener('contextmenu', this._clickListener, true);