Skip to content

Commit 1cb5d01

Browse files
authored
Fix zooming out and firefox iframe height issues (#171)
* fix Firefox issue when iframes are scaled down, they have phantom extended height, causing main page to show scrollbars * fix zooming out defaulting to browser page zoom when focused on chii devtool * revert unocss file * changed iframe editors to absolute position
1 parent 0bcaaac commit 1cb5d01

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/solid-repl/src/components/preview.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const dispatchKeyboardEventToParentZoomState = () => `
1616
window.parent.document.dispatchEvent(keyboardEvent);
1717
1818
e.preventDefault();
19-
});
19+
}, true);
2020
`;
2121

2222
const generateHTML = (isDark: boolean, importMap: string) => `
@@ -301,10 +301,10 @@ export const Preview: Component<Props> = (props) => {
301301
});
302302
return (
303303
<div class="flex min-h-0 flex-1 flex-col" ref={outerContainer} classList={props.classList}>
304-
<div class="min-h-0 min-w-0" style={`flex: ${props.devtools ? iframeHeight() : '1 1 100%'};`}>
304+
<div class="relative" style={`flex: ${props.devtools ? iframeHeight() : '1 1 100%'};`}>
305305
<iframe
306306
title="Solid REPL"
307-
class="dark:bg-other block h-full w-full overflow-scroll bg-white p-0"
307+
class="dark:bg-other absolute inset-0 block h-full w-full overflow-scroll bg-white p-0"
308308
style={styleScale()}
309309
ref={iframe}
310310
src={iframeSrcUrl()}
@@ -328,10 +328,10 @@ export const Preview: Component<Props> = (props) => {
328328
}}
329329
/>
330330
</Show>
331-
<div class="min-h-0 min-w-0" style={`flex: ${1 - iframeHeight()};`}>
331+
<div class="relative" style={`flex: ${1 - iframeHeight()};`}>
332332
<iframe
333333
title="Devtools"
334-
class="h-full w-full"
334+
class="absolute inset-0 block h-full w-full"
335335
style={styleScale()}
336336
ref={devtoolsIframe}
337337
src={devtoolsSrc}

0 commit comments

Comments
 (0)