diff --git a/src/App.css b/src/App.css index 4e75be2c2..b1a9e1ff2 100644 --- a/src/App.css +++ b/src/App.css @@ -16,13 +16,6 @@ format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */ } -/* Needed for the fallbacks below */ -@supports (height: -webkit-fill-available) { - :root { - --webkit-vhh: -webkit-fill-available; - } -} - :root { /* Seems to fix a Safari glitch: https://github.com/microbit-foundation/python-editor-v3/issues/369 */ font-size: 16px; @@ -34,9 +27,9 @@ body, .WorkbenchContainer, .Workbench { width: 100%; - /* --ios-vvh set by VisualViewPortCSSVariables on iOS only. */ - height: var(--ios-vvh, var(--webkit-vvh, 100vh)); -} -body { - overflow: hidden; + height: 100%; + /* 516px is the min height of the sidebar */ + min-height: 516px; + /* 372px is the sidebar width + simulator width */ + min-width: 372px; } diff --git a/src/App.tsx b/src/App.tsx index 1e2187d5a..71c5f9dcf 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -8,7 +8,6 @@ import { polyfill } from "mobile-drag-drop"; import { useEffect } from "react"; import "./App.css"; import { DialogProvider } from "./common/use-dialogs"; -import VisualViewPortCSSVariables from "./common/VisualViewportCSSVariables"; import { deployment, useDeployment } from "./deployment"; import { MicrobitWebUSBConnection } from "./device/webusb"; import { DeviceContextProvider } from "./device/device-hooks"; @@ -65,7 +64,6 @@ const App = () => { const { ConsentProvider } = deployment.compliance; return ( <> - diff --git a/src/common/SplitView/SplitViewSized.tsx b/src/common/SplitView/SplitViewSized.tsx index 83f8d9f24..44f79d67e 100644 --- a/src/common/SplitView/SplitViewSized.tsx +++ b/src/common/SplitView/SplitViewSized.tsx @@ -3,9 +3,9 @@ * * SPDX-License-Identifier: MIT */ +import { Box } from "@chakra-ui/layout"; import { createRef, useEffect } from "react"; import { dimensionPropName, useSplitViewContext } from "./context"; -import { Box } from "@chakra-ui/layout"; interface SizedPaneProps { children: JSX.Element; @@ -38,6 +38,7 @@ const SplitViewSized = ({ children }: SizedPaneProps) => { return ( diff --git a/src/common/VisualViewportCSSVariables.tsx b/src/common/VisualViewportCSSVariables.tsx deleted file mode 100644 index 88a3c3853..000000000 --- a/src/common/VisualViewportCSSVariables.tsx +++ /dev/null @@ -1,52 +0,0 @@ -/** - * (c) 2021, Micro:bit Educational Foundation and contributors - * - * SPDX-License-Identifier: MIT - */ -import { useEffect } from "react"; - -const styleId = "vvp-style"; - -const isIOS = (): boolean => - /iPad|iPhone|iPod/.test(navigator.platform) || - (navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1); - -/** - * Maintains CSS variables for the visual viewport width and height. - * Use with fallbacks, e.g. var(--ios-vvh, 100vh) - * https://developer.mozilla.org/en-US/docs/Web/API/Visual_Viewport_API - * - * This is important for iOS where we want to avoid the keyboard being - * drawn over the toolbar at the bottom. - * - * We skip it on other platforms and rely on the fallback. - */ -const VisualViewPortCSSVariables = () => { - useEffect(() => { - // If we remove the iOS check then we should look carefully at resize performance. - if (!window.visualViewport || !isIOS()) { - return; - } - const resizeHandler = () => { - const { width, height } = window.visualViewport ?? {}; - let style = document.getElementById(styleId); - if (!style) { - style = document.head.appendChild(document.createElement("style")); - style.id = styleId; - } - style.innerText = `:root { --ios-vvw: ${width}px; --ios-vvh: ${height}px; }`; - }; - window.visualViewport.addEventListener("resize", resizeHandler); - resizeHandler(); - return () => { - window.visualViewport?.removeEventListener("resize", resizeHandler); - const style = document.getElementById(styleId); - if (style) { - style.remove(); - } - }; - }, []); - return null; -}; - -export default VisualViewPortCSSVariables;