From 2abed7bb348de13a0e3f27a325600fcee670050a Mon Sep 17 00:00:00 2001 From: IzaacAyelin <47495047+IzaacAyelin@users.noreply.github.com> Date: Sun, 25 Feb 2024 11:51:05 +0200 Subject: [PATCH] deffer click events and mobile hover (#1190) * test * dummy * events * jover * actions * yml --- .../components/gallery/proGallery/galleryContainer.js | 9 ++++++++- packages/gallery/src/components/item/itemView.js | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/gallery/src/components/gallery/proGallery/galleryContainer.js b/packages/gallery/src/components/gallery/proGallery/galleryContainer.js index 297fe5d0e..a7492e2ad 100644 --- a/packages/gallery/src/components/gallery/proGallery/galleryContainer.js +++ b/packages/gallery/src/components/gallery/proGallery/galleryContainer.js @@ -764,7 +764,14 @@ export class GalleryContainer extends React.Component { } } if (typeof this.props.eventsListener === 'function') { - this.props.eventsListener(eventName, eventData, event); + switch (eventName) { + case GALLERY_CONSTS.events.ITEM_ACTION_TRIGGERED: + case GALLERY_CONSTS.events.ITEM_CLICKED: + setTimeout(this.props.eventsListener(eventName, eventData, event), 0); + break; + default: + this.props.eventsListener(eventName, eventData, event); + } } if (eventName === GALLERY_CONSTS.events.GALLERY_SCROLLED) { diff --git a/packages/gallery/src/components/item/itemView.js b/packages/gallery/src/components/item/itemView.js index a185d72a3..46c6c4a40 100644 --- a/packages/gallery/src/components/item/itemView.js +++ b/packages/gallery/src/components/item/itemView.js @@ -203,7 +203,7 @@ class ItemView extends React.Component { this.shouldShowHoverOnMobile() || this.shouldShowSecondMediaOnMobile() ) { - this.handleHoverClickOnMobile(e); + setTimeout(this.handleHoverClickOnMobile(e), 0); } else { this.handleGalleryItemAction(e); }