Skip to content

Commit

Permalink
trigger hover when without overlay and no action ON MOBILE (#1213)
Browse files Browse the repository at this point in the history
* trigger hover when without overlay and no action ON MOBILE

* fix lint
  • Loading branch information
liatv authored Apr 25, 2024
1 parent 2eb461b commit 2a6f6ce
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/gallery/src/components/item/itemView.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ class ItemView extends React.Component {
this.onBlur = this.onBlur.bind(this);
this.checkIfCurrentHoverChanged =
this.checkIfCurrentHoverChanged.bind(this);
this.shouldHoverWithoutOverlayAndClickOnMobile =
this.shouldHoverWithoutOverlayAndClickOnMobile.bind(this);
}

//----------------------------------------| ACTIONS |-------------------------------------------//
Expand Down Expand Up @@ -204,6 +206,11 @@ class ItemView extends React.Component {
this.shouldShowSecondMediaOnMobile()
) {
setTimeout(this.handleHoverClickOnMobile(e), 0);
} else if (this.shouldHoverWithoutOverlayAndClickOnMobile()) {
this.props.actions.eventsListener(
GALLERY_CONSTS.events.HOVER_SET,
this.props.idx
);
} else {
this.handleGalleryItemAction(e);
}
Expand Down Expand Up @@ -323,6 +330,15 @@ class ItemView extends React.Component {
return false;
}

shouldHoverWithoutOverlayAndClickOnMobile() {
return (
utils.isMobile() &&
this.props.options.behaviourParams.item.video.playTrigger ===
GALLERY_CONSTS.videoPlay.HOVER &&
this.props.options.itemClick === GALLERY_CONSTS.itemClick.NOTHING
);
}

isHighlight() {
return (
this.props.thumbnailHighlightId &&
Expand Down

0 comments on commit 2a6f6ce

Please sign in to comment.