Ignore:
Timestamp:
11/25/21 22:08:24 (3 years ago)
Author:
Ema <ema_spirova@…>
Branches:
master
Children:
8d391a1
Parents:
59329aa
Message:

primeNG components

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trip-planner-front/node_modules/@angular/cdk/__ivy_ngcc__/fesm2015/overlay.js

    r59329aa re29cc2e  
    617617        this._platform = _platform;
    618618        this._cursorStyleIsSet = false;
     619        /** Store pointerdown event target to track origin of click. */
     620        this._pointerDownListener = (event) => {
     621            this._pointerDownEventTarget = _getEventTarget(event);
     622        };
    619623        /** Click event listener that will be attached to the body propagate phase. */
    620624        this._clickListener = (event) => {
    621625            const target = _getEventTarget(event);
     626            // In case of a click event, we want to check the origin of the click
     627            // (e.g. in case where a user starts a click inside the overlay and
     628            // releases the click outside of it).
     629            // This is done by using the event target of the preceding pointerdown event.
     630            // Every click event caused by a pointer device has a preceding pointerdown
     631            // event, unless the click was programmatically triggered (e.g. in a unit test).
     632            const origin = event.type === 'click' && this._pointerDownEventTarget
     633                ? this._pointerDownEventTarget : target;
     634            // Reset the stored pointerdown event target, to avoid having it interfere
     635            // in subsequent events.
     636            this._pointerDownEventTarget = null;
    622637            // We copy the array because the original may be modified asynchronously if the
    623638            // outsidePointerEvents listener decides to detach overlays resulting in index errors inside
     
    634649                }
    635650                // If it's a click inside the overlay, just break - we should do nothing
    636                 // If it's an outside click dispatch the mouse event, and proceed with the next overlay
    637                 if (overlayRef.overlayElement.contains(target)) {
     651                // If it's an outside click (both origin and target of the click) dispatch the mouse event,
     652                // and proceed with the next overlay
     653                if (overlayRef.overlayElement.contains(target) ||
     654                    overlayRef.overlayElement.contains(origin)) {
    638655                    break;
    639656                }
     
    653670        if (!this._isAttached) {
    654671            const body = this._document.body;
     672            body.addEventListener('pointerdown', this._pointerDownListener, true);
    655673            body.addEventListener('click', this._clickListener, true);
    656674            body.addEventListener('auxclick', this._clickListener, true);
     
    670688        if (this._isAttached) {
    671689            const body = this._document.body;
     690            body.removeEventListener('pointerdown', this._pointerDownListener, true);
    672691            body.removeEventListener('click', this._clickListener, true);
    673692            body.removeEventListener('auxclick', this._clickListener, true);
Note: See TracChangeset for help on using the changeset viewer.