Repository: vscode
Issue: window.innerHeight is way larger than the actual window height on macOS
Labels: debt,polish,notebook

Type: <b>Bug</b>

1. First install `ipykernel` and `anywidget` (`!pip install anywidget`)
2. Create a notebook file `test.ipynb`
3. Create the following widget and inspect the console.log statement

```py
import anywidget

class CanvasWidget(anywidget.AnyWidget):
    _esm = """
    function render({ model, el }) {
      const canvas = document.createElement("canvas");

      const resize = () => {
        canvas.height = window.innerHeight * window.devicePixelRatio;
        canvas.width = window.innerWidth * window.devicePixelRatio;
        console.log(`Canvas size is ${canvas.width} (w) x ${canvas.height} (h)`);
      }
      
      window.addEventListener('resize', resize);

      el.appendChild(canvas);
    }
    export default { render };
    """

CanvasWidget()
```

In my case the reported canvas size is `1940 (w) x 33554426 (h)`. While the width is correct the height is complete out of bounds! I don't think there exists a monitor with a 33 million pixels tall display panel.

When I manual get the `window.innerHeight`, `window.innerWidth`, `window.devicePixelRatio` in the web console, the values are `1091`, `1118` , and `2`.

![Screenshot 2024-08-16 at 3 21 39 PM](https://github.com/user-attachments/assets/2cd4a995-7bd9-4c76-ab99-326a592a5a64)

Where is the incorrect height of `33554426` coming from?! And is there a way around this?

**tl/dr** I'm the developer of a widget that relies on the window size to determine the appropriate size for a full-sized canvas element. However, the incorrect height of `33554426` is causing the widget to break because no GPU can work with a texture that large (which is what ultimately happens in the widget)

VS Code version: Code 1.92.2 (Universal) (fee1edb8d6d72a0ddff41e5f71a671c23ed924b9, 2024-08-14T17:29:30.058Z)
OS version: Darwin arm64 23.2.0
Modes:

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|Apple M1 Max (10 x 2400)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: enabled_on<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: enabled<br>multiple_raster_threads: enabled_on<br>opengl: enabled_on<br>rasterization: enabled<br>raw_draw: disabled_off_ok<br>skia_graphite: disabled_off<br>video_decode: enabled<br>video_encode: enabled<br>webgl: enabled<br>webgl2: enabled<br>webgpu: enabled<br>webnn: disabled_off|
|Load (avg)|4, 6, 8|
|Memory (System)|32.00GB (0.71GB free)|
|Process Argv||
|Screen Reader|no|
|VM|0%|
</details><details><summary>Extensions (15)</summary>

Extension|Author (truncated)|Version
---|---|---
vscode-eslint|dba|3.0.10
gitlens|eam|15.3.0
EditorConfig|Edi|0.16.4
vsc-material-theme|Equ|2.4.2
debugpy|ms-|2024.10.0
isort|ms-|2023.10.1
python|ms-|2024.12.3
vscode-pylance|ms-|2024.8.1
jupyter|ms-|2024.7.0
jupyter-keymap|ms-|1.1.2
jupyter-renderers|ms-|1.0.19
vscode-jupyter-cell-tags|ms-|0.1.9
vscode-jupyter-slideshow|ms-|0.1.6
cpptools|ms-|1.21.6
sublime-keybindings|ms-|4.1.10

(1 theme extensions excluded)

</details>
<!-- generated by issue reporter -->