Skip to content

Commit 797ebd1

Browse files
authored
fix: Wait for the correct clientWidth/clientHeight when showing Feedback Screenshot previews (#16648)
Before we would see a blank screenshot in the feedback modal when using firefox. After resizing the screenshot would appear. I debugged and foundout that the clientWidth/clientHeight wasn't being set right away, therefore the elements were on the page properly, and contained the correct pixel information drawn into the canvas, but the canvas wasn't sized correctly on the page, so you couldn't see anything. This triggers a resize after a tick, giving the browser a chance first set the width/height before we measure it and set the scale factor. **Before:** <img width="1282" alt="SCR-20250618-kgwr" src="https://github.com/user-attachments/assets/c95f82f1-8468-4640-86ec-ca30874ce841" /> After: <img width="1282" alt="SCR-20250618-kgrm" src="https://github.com/user-attachments/assets/e79e62df-ed53-4933-b42c-abd2ce520dd1" /> Fixes REPLAY-420
1 parent 4bbe610 commit 797ebd1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/feedback/src/screenshot/components/ScreenshotEditor.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,11 @@ export function ScreenshotEditorFactory({
166166
);
167167
setScaleFactor(scale);
168168
});
169+
170+
// For Firefox, the canvas is not yet measured, so we need to wait for it to get the correct size
171+
if (measurementDiv.clientHeight === 0 || measurementDiv.clientWidth === 0) {
172+
setTimeout(handleResize, 0);
173+
}
169174
};
170175

171176
handleResize();

0 commit comments

Comments
 (0)