Skip to content

Commit

Permalink
fixing reduce motion (#1299)
Browse files Browse the repository at this point in the history
  • Loading branch information
hadasze authored Dec 9, 2024
1 parent 5802727 commit bcb3e15
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,23 @@ class VideoItemWrapper extends React.Component {
mightPlayVideo() {
const { videoPlay, itemClick } = this.props.options;
const { hasLink } = this.props;
const prefersReducedMotion =
window.matchMedia &&
window.matchMedia('(prefers-reduced-motion: reduce)').matches;

if (this.props.isVideoPlaceholder) {
return false;
}
if (prefersReducedMotion && videoPlay === 'auto') {
return false;
}
if (videoPlay === 'hover' || videoPlay === 'auto') {
return true;
} else if (itemClick === 'nothing') {
return true;
} else if (itemClick === 'link' && !hasLink) {
return true;
}
// }
return false;
}

Expand Down

0 comments on commit bcb3e15

Please sign in to comment.