Skip to content

Commit 89de902

Browse files
authored
Merge pull request #14934 from guardian/doml/fix-loop-hover
Fix hover states with loops/cinemagraphs
2 parents 85f28cf + 8670be9 commit 89de902

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

dotcom-rendering/src/components/Card/components/CardWrapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const hoverStyles = css`
5858
*/
5959
:has(
6060
ul.sublinks:hover,
61-
.video-container.loop:hover,
61+
.video-container:not(.cinemagraph):hover,
6262
.slideshow-carousel-footer:hover,
6363
.branding-logo:hover
6464
) {

dotcom-rendering/src/components/SelfHostedVideo.importable.tsx

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ import type {
3030
import { SelfHostedVideoPlayer } from './SelfHostedVideoPlayer';
3131
import { ophanTrackerWeb } from './YoutubeAtom/eventEmitters';
3232

33-
const videoAndBackgroundStyles = css`
33+
const videoAndBackgroundStyles = (isCinemagraph: boolean) => css`
3434
position: relative;
3535
display: flex;
3636
justify-content: space-around;
37-
z-index: ${getZIndex('video-container')};
3837
background-color: ${palette('--video-background')};
38+
${!isCinemagraph && `z-index: ${getZIndex('video-container')}`};
3939
`;
4040

4141
const videoContainerStyles = (width: number, height: number) => css`
@@ -49,10 +49,6 @@ const videoContainerStyles = (width: number, height: number) => css`
4949
}
5050
`;
5151

52-
const cinemagraphContainerStyles = css`
53-
pointer-events: none;
54-
`;
55-
5652
/**
5753
* Dispatches a custom play audio event so that other videos listening
5854
* for this event will be muted.
@@ -677,13 +673,10 @@ export const SelfHostedVideo = ({
677673
: undefined;
678674

679675
return (
680-
<div css={videoAndBackgroundStyles} className="loop-video-container">
676+
<div css={videoAndBackgroundStyles(isCinemagraph)}>
681677
<figure
682678
ref={setNode}
683-
css={[
684-
videoContainerStyles(width, height),
685-
isCinemagraph && cinemagraphContainerStyles,
686-
]}
679+
css={videoContainerStyles(width, height)}
687680
className={`video-container ${videoStyle.toLocaleLowerCase()}`}
688681
data-component="gu-video-loop"
689682
>

0 commit comments

Comments
 (0)