Skip to content

fix(extension): pin the popup width to 360px on the root element - #358

Merged
vineethkrishnan merged 1 commit into
mainfrom
fix/extension-popup-window-width
Aug 19, 2026
Merged

fix(extension): pin the popup width to 360px on the root element#358
vineethkrishnan merged 1 commit into
mainfrom
fix/extension-popup-window-width

Conversation

@vineethkrishnan

Copy link
Copy Markdown
Owner

Problem

The popup opened in a window about twice its usual width. Measured from the report screenshot, the window's content area was 720x539: the height matches the CSS body height (540), while the width is exactly 2x the 360px body, which floated centred in an oversized viewport.

Nothing in the extension asks for that size:

  • the only windows.create (extension/entrypoints/background.ts:1688) requests 384x640, and never requested anything wider in its history (400x620 -> 376x600 -> 384x640);
  • the shipped 1.27.1 bundle still carries body{width:360px;height:540px;...}, so the fixed box is intact;
  • Chrome's stored prefs hold no matching remembered bounds.

So the width was chosen by the browser, not by us. The page gave it room to: the width was pinned only on body, html had a height but no width, and index.html carried <meta name="viewport" content="width=device-width, initial-scale=1.0">, which hands the layout viewport to the device rather than to our CSS.

Change

  • Pin width: 360px (and the auto margins that centre it) on html, so the popup's width cannot be inferred from whatever viewport the browser hands the page.
  • Drop the width=device-width viewport meta from the popup document; an extension popup has no device viewport to adapt to.
  • body keeps its own 360x540 box, and the sub-viewport scroll fallback added in fix(extension): recognize the unlock window as an extension page #347 is untouched.

Verification

CSS has no automated coverage here, so this was checked against a real build. Built the extension and served .output/chrome-mv3/popup.html in a 1920px-wide Chrome viewport:

viewport: [1920, 934]   dpr: 2
html:     360 wide, left 780
body:     360 x 540, left 780

The UI renders as a centred 360px column with the themed background filling the window, instead of stretching or drifting. Built CSS confirms html{width:360px;height:100%;margin:0 auto} and the body theme block is unchanged.

The popup opened in a window roughly twice its usual width: a 720x539 viewport with the fixed 360px body floating in the middle. Nothing in the extension asks for that size - the unlock fallback requests 384x640 and the CSS body has been 360x540 throughout - so the width was inferred by the browser from a page that pinned its width only on body, with a `width=device-width` viewport meta inviting the device to decide.

Pins the width (and the auto margins that centre it) on html as well, and drops the viewport meta, which an extension popup has no use for. The body keeps its own 360x540 box and the sub-viewport scroll fallback is untouched.
@vineethkrishnan
vineethkrishnan force-pushed the fix/extension-popup-window-width branch from f18fd19 to 8ba0ad3 Compare August 19, 2026 12:45
@vineethkrishnan
vineethkrishnan merged commit 691720e into main Aug 19, 2026
8 checks passed
@vineethkrishnan
vineethkrishnan deleted the fix/extension-popup-window-width branch August 19, 2026 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant