MicrosoftEdge / MicrosoftEdge/WebView2Feedback

[Problem/Bug]: outerHeight equals innerHeight; host window size and Y never reflected

Open
#5,700 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

Description

What happened?

outerHeight reports WebView bounds, not host window bounds

In WebView2, window.outerHeight always equals window.innerHeight. In composition/visual hosting mode, where the host app draws its own chrome (tab strip, address bar, toolbar) above and below the WebView, the difference between the two is exactly the chrome the app has drawn but web content sees no difference at all.

This persists after the page has fully loaded and layout has settled, so it is distinct from the timing issue in #5467. The underlying problem is that WebView2 has no concept of a host window rect separate from the controller bounds.

outerWidth is correct in our case, since our chrome is horizontal-only and the WebView spans the full window width. But the same limitation would presumably surface as a width discrepancy for any host drawing a sidebar or side panel.

Importance

Blocking. My app's basic functions are not working due to this issue.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

No response

SDK Version

No response

Framework

Win32

Operating System

Windows 10

OS Version

No response

Repro steps

Repro steps

Create a Win32 host window, 1280×800 at screen position (100, 50).
Create a WebView2 environment and call CreateCoreWebView2CompositionController.
Set the controller bounds to leave room for host-drawn chrome (e.g. a 92px tab strip and address bar along the top) giving the WebView a rect of 1280×708 at (100, 142).
Navigate to a page and wait for NavigationCompleted.
In the page, evaluate:

console.log({
innerHeight: window.innerHeight,
outerHeight: window.outerHeight,
innerWidth: window.innerWidth,
outerWidth: window.outerWidth,
screenY: window.screenY,
screenTop: window.screenTop
});

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

No, this never worked

Last working version (if regression)

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Win32 reproduction using CreateCoreWebView2CompositionController and the controller bounds described in the issue. Evaluate the listed window properties after NavigationCompleted and compare them with the host window bounds; done should establish whether outerHeight, screenY, and screenTop can reflect host-drawn chrome rather than only the WebView bounds.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
desktop
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.