[Bug]: Device-toolbar viewport size does not match the CSS viewport the page receives (~1.44× larger)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 23k
- Forks
- 5.9k
- Avg merge
- 11h 14m
- Merged PRs (30d)
- 357
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/desktop
Steps to reproduce
-
Open any local page in the Preview panel (I used a Vite dev server on
http://localhost:5243). -
Open the device toolbar and set the viewport to
375 × 667(freeform), or pick the iPhone SE preset. -
In the page, read the CSS viewport:
({ innerWidth, innerHeight, devicePixelRatio, scale: visualViewport.scale }) -
Repeat with
390 × 844and271 × 586.
Expected behavior
The CSS viewport the page lays out in matches the size the device toolbar displays: 375 × 667 gives innerWidth === 375, so mobile breakpoints and wrapping behave as they would on the named device.
Actual behavior
The page receives a viewport about 1.44× larger than the displayed size, at every size:
| Toolbar setting | innerWidth × innerHeight |
|---|---|
| 375 × 667 | 540 × 961 |
| 390 × 844 | 562 × 1216 |
| 271 × 586 | 390 × 844 |
devicePixelRatio is 2 and visualViewport.scale is 1, so the page itself is not zoomed; the panel is supplying a larger viewport than it reports. preview_status sometimes reports the displayed size (viewport: {width: 390, height: 844}) while the DOM reports 562 for the same tab.
The practical effect is that a "375 wide" preview renders layouts a real 375px device would not: a header that wraps to two rows on an iPhone SE stays on one row here, and a day strip shows eight days where the device shows five. To see the true 375px layout you have to type 260 × 463.
This may be tied to the preview zoom level (the kebab-menu zoom from #8900). In Chrome's device toolbar, zoom scales the rendered frame without changing the CSS viewport; here the CSS viewport seems to scale with it. The preview_resize timeouts are already covered by #3712 and are not part of this report.
Version
T3 Code (Nightly) 0.0.38-nightly.20260901.1250, macOS 26.6.2, external display reporting screen.width 2560 at 2×. MCP client: Claude Code.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue in apps/desktop using the device toolbar at the reported viewport sizes, then compare the toolbar dimensions with innerWidth, innerHeight, devicePixelRatio, visualViewport.scale, and preview_status. Trace the preview sizing and zoom behavior, including the preview_resize path mentioned in the report. Done means the page receives the displayed CSS viewport at each size without changing the reported device pixel ratio or zoom.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- desktop, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100