Skip to content

Commit

Permalink
Fix lightbox opening animation for video
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmz committed Feb 4, 2025
1 parent a140d1e commit dc20d18
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/components/post/attachments/attachments.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
cursor: move;
}

.visual__video {
position: absolute;
}

.visual__overlay {
position: absolute;
color: #fff;
Expand Down
19 changes: 15 additions & 4 deletions src/components/post/attachments/visual.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,23 @@ export function VisualAttachment({
target="_blank"
data-pid={pictureId}
>
{att.mediaType === 'image' ? (
<img id={pictureId} src={imageSrc} alt={alt} loading="lazy" width={width} height={height} />
) : (
{/**
* This image is used for the proper lightbox opening animation,
* even if the attachment has 'video' type.
*/}
<img
id={pictureId}
src={imageSrc}
alt={alt}
loading="lazy"
width={width}
height={height}
aria-hidden={att.mediaType === 'video'}
/>
{att.mediaType === 'video' && (
<>
<video
id={pictureId}
className={style['visual__video']}
src={videoSrc}
poster={imageSrc}
alt={alt}
Expand Down

0 comments on commit dc20d18

Please sign in to comment.