Skip to content

Commit bf57877

Browse files
committed
fix(web-components): constrain portrait media to viewport height
Portrait screenshots and videos were stretched to full panel width, making them impractical on wide screens. Apply max-height: 80vh with auto width/height so landscape media still fills available width while portrait media stays within the visible viewport. Fixes #534
1 parent d4715f7 commit bf57877

3 files changed

Lines changed: 27 additions & 6 deletions

File tree

packages/web-classic/src/components/TestResult/TestResultSteps/attachmentVideo.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import { Spinner } from "@allurereport/web-components";
22
import { type FunctionalComponent } from "preact";
33

4+
import * as styles from "./styles.scss";
5+
46
export const AttachmentVideo: FunctionalComponent<{
57
attachment: { src: string; contentType?: string };
68
}> = ({ attachment }) => {
79
if (!attachment) {
810
return <Spinner />;
911
}
1012
return (
11-
<video controls loop muted>
13+
<video class={styles["test-result-attachment-video"]} controls loop muted>
1214
<source src={attachment?.src} type={attachment?.contentType} />
1315
</video>
1416
);

packages/web-classic/src/components/TestResult/TestResultSteps/styles.scss

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,12 @@
159159
height: 100%;
160160

161161
img {
162-
width: 100%;
163-
height: 100%;
164-
object-fit: scale-down;
162+
display: block;
163+
max-width: 100%;
164+
max-height: 80vh;
165+
width: auto;
166+
height: auto;
167+
object-fit: contain;
165168
}
166169
}
167170

@@ -228,3 +231,11 @@
228231
.html-attachment-preview {
229232
padding: 0 16px;
230233
}
234+
235+
.test-result-attachment-video {
236+
display: block;
237+
max-width: 100%;
238+
max-height: 80vh;
239+
width: auto;
240+
height: auto;
241+
}

packages/web-components/src/components/Attachment/styles.scss

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,11 @@
157157
height: 100%;
158158

159159
img {
160-
width: 100%;
160+
display: block;
161+
max-width: 100%;
162+
max-height: 80vh;
163+
width: auto;
164+
height: auto;
161165
object-fit: contain;
162166
}
163167
}
@@ -236,7 +240,11 @@
236240
}
237241

238242
.test-result-attachment-video {
239-
width: 100%;
243+
display: block;
244+
max-width: 100%;
245+
max-height: 80vh;
246+
width: auto;
247+
height: auto;
240248
}
241249

242250
.imageDiffWrapper {

0 commit comments

Comments
 (0)