Skip to content

Commit

Permalink
force video play action on mobile to be click (#1211)
Browse files Browse the repository at this point in the history
* force video play action on mobile to be click

* move logic to itemview

* act the same loggic if hover on mocile

* trigger hover when without overlay and no action
  • Loading branch information
liatv committed Apr 25, 2024
1 parent 1047336 commit ccdca49
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/gallery/src/components/item/itemView.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class ItemView extends React.Component {
this.onFocus = this.onFocus.bind(this);
this.onBlur = this.onBlur.bind(this);
this.checkIfCurrentHoverChanged = this.checkIfCurrentHoverChanged.bind(this);
this.shouldHoverWithoutOverlayAndClickOnMobile = this.shouldHoverWithoutOverlayAndClickOnMobile.bind(this);
}

//----------------------------------------| ACTIONS |-------------------------------------------//
Expand Down Expand Up @@ -142,6 +143,8 @@ class ItemView extends React.Component {

if (this.shouldShowHoverOnMobile() || this.shouldShowSecondMediaOnMobile()) {
this.handleHoverClickOnMobile(e);
} else if (this.shouldHoverWithoutOverlayAndClickOnMobile()) {
this.props.actions.eventsListener(GALLERY_CONSTS.events.HOVER_SET, this.props.idx);
} else {
this.handleGalleryItemAction(e);
}
Expand Down Expand Up @@ -257,6 +260,16 @@ class ItemView extends React.Component {
return false;
}

shouldHoverWithoutOverlayAndClickOnMobile() {
return (
utils.isMobile() &&
this.props.options[optionsMap.behaviourParams.item.video.playTrigger] ===
GALLERY_CONSTS[optionsMap.behaviourParams.item.video.playTrigger].HOVER &&
this.props.options[optionsMap.behaviourParams.item.clickAction] ===
GALLERY_CONSTS[optionsMap.behaviourParams.item.clickAction].NOTHING
);
}

isHighlight() {
return this.props.thumbnailHighlightId && this.props.thumbnailHighlightId === this.props.id;
}
Expand Down

0 comments on commit ccdca49

Please sign in to comment.