diff --git a/packages/extension-ui/src/createView.tsx b/packages/extension-ui/src/createView.tsx index 1851529003..98250c7b2b 100644 --- a/packages/extension-ui/src/createView.tsx +++ b/packages/extension-ui/src/createView.tsx @@ -10,6 +10,24 @@ import { HashRouter } from 'react-router-dom'; import { View } from './components/index.js'; export default function createView (Entry: React.ComponentType, rootId = 'root'): void { + const targetInnerWidth = 560; + const targetInnerHeight = 600; + + // Popup window size is initially set via chrome.windows.create, however + // it will result in different inner dimensions on Windows and Mac OS. + // This is a hacky way to have a consistent popup size + if ( + window.innerWidth !== targetInnerWidth || + window.innerHeight !== targetInnerHeight + ) { + const newOuterWidth = + targetInnerWidth + (window.outerWidth - window.innerWidth); + const newOuterHeight = + targetInnerHeight + (window.outerHeight - window.innerHeight); + + window.resizeTo(newOuterWidth, newOuterHeight); + } + const rootElement = document.getElementById(rootId); if (!rootElement) {