Skip to content

Commit b2ebc44

Browse files
committed
fix live preview scrolling
1 parent f9b962d commit b2ebc44

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

resources/js/components/ui/LivePreview/LivePreview.vue

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,18 @@ function setEditorWidth(width) {
271271
localStorage.setItem(widthLocalStorageKey, width);
272272
}
273273
274+
function onResizeEnd() {
275+
editorResizing.value = false;
276+
277+
// Chromium doesn't recalculate iframe scroll state after the parent
278+
// container is resized. Toggling a transform forces a reflow. #14540
279+
const iframe = iframeContentContainer.value?.querySelector('iframe');
280+
if (iframe) {
281+
iframe.style.transform = 'translateZ(0)';
282+
requestAnimationFrame(() => iframe.style.transform = '');
283+
}
284+
}
285+
274286
function close() {
275287
if (poppedOut.value) closePopout();
276288
@@ -343,7 +355,7 @@ Statamic.$events.$on(`live-preview.${name.value}.refresh`, () => {
343355
v-show="!poppedOut"
344356
@resized="setEditorWidth"
345357
@resize-start="editorResizing = true"
346-
@resize-end="editorResizing = false"
358+
@resize-end="onResizeEnd"
347359
@collapsed="collapseEditor"
348360
/>
349361
</div>

0 commit comments

Comments
 (0)