Skip to content

[bug] [Linux/Wayland] window.add_child() child webview renders with incorrect bounds on Ubuntu 26.04 + WebKitGTK 2.52.3 #15656

Description

@hozaifa-ali

Describe the bug

Child webview created with window.add_child() renders incorrectly on Linux Wayland.
The webview overflows outside its intended area and covers the sidebar and side panel
of the UI instead of staying in the content area between them.

This works perfectly on macOS but is completely broken on Ubuntu 26.04 (Wayland)
with WebKitGTK 2.52.3. No matter what coordinate system we use — Logical, Physical,
manual scale_factor() multiplication — the position and size is always wrong.

Image

Reproduction

  1. Create a Tauri 2 app with a React frontend webview filling the whole window
  2. Add a sidebar (56px) and tab bar (40px) in the React UI
  3. Call window.add_child() to spawn a child webview in the remaining content area
  4. Pass bounds from getBoundingClientRect() on the content div
  5. Run on Linux Ubuntu — child webview overflows over the sidebar and panels
  6. Run same code on macOS — works perfectly

Code used:
window.add_child(
builder,
tauri::Position::Logical(tauri::LogicalPosition::new(x, y)),
tauri::Size::Logical(tauri::LogicalSize::new(width, height)),
)

Bounds come from getBoundingClientRect() with no DPR multiplication.

Expected behavior

The child webview should appear only inside the content area —
to the right of the sidebar and below the tab bar — matching
exactly the bounds passed to add_child(). Same behavior as macOS.

Full tauri info output

[✘] Environment
    - OS: Ubuntu 26.4.0 x86_64 (X64) (ubuntu on wayland)
    ✔ webkit2gtk-4.1: 2.52.3
    ✘ rsvg2: not installed
    ✔ rustc: 1.96.0 (ac68faa20 2026-05-25)
    ✔ cargo: 1.96.0 (30a34c682 2026-05-25)
    ✔ rustup: 1.29.0 (28d1352db 2026-03-05)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (default)
    - node: 24.18.0
    - npm: 11.16.0

[-] Packages
    - tauri 🦀: 2.11.5
    - tauri-build 🦀: 2.6.3
    - wry 🦀: 0.55.1
    - tao 🦀: 0.35.3
    - @tauri-apps/api ⱼₛ: 2.11.1
    - @tauri-apps/cli ⱼₛ: 2.11.4

[-] Plugins
    - tauri-plugin-fs 🦀: 2.5.1
    - tauri-plugin-dialog 🦀: 2.7.1
    - tauri-plugin-shell 🦀: 2.3.5

[-] App
    - build-type: bundle
    - framework: React
    - bundler: Vite
    - Running on Wayland

Stack trace

No crash or stack trace. The webview renders in the wrong 
position silently with no errors.

Additional context

OS: Ubuntu 26.04
WebKitGTK: 2.52.3 (libwebkit2gtk-4.1-0)
Rust: 1.96.0
Node: v24.18.0

We tried every coordinate approach:

  • Physical pixels with manual scale_factor() multiply = double scaled, wrong
  • Hardcoded inner_size() minus sidebar pixels = wrong when panel opens
  • LogicalPosition directly from getBoundingClientRect() = still overflows
  • Ratio scaling between JS viewport and native window = still off

Root cause appears to be that on Linux/GTK, add_child() creates a separate
GtkWindow instead of truly embedding the webview, so it uses a different
coordinate space than the WebKit CSS pixels from getBoundingClientRect().

Important: running on Wayland (not X11).
The tauri info output shows "ubuntu on wayland".
This may be relevant since Wayland handles window
coordinates differently from X11 and could be
contributing to the add_child() bounds issue.

Screenshot attached showing the overflow.

Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions