Skip to content

Web: open_window and overlays draw as in-canvas windows instead of being ignored #1322

Open

Description

@martipops

WEB.md says the wasm target has no extra windows or overlays, and open_window / Show / Open are ignored with a console warning. So an app that uses more than one window on the desktop (a settings window, a floating panel, a tab dragged out into its own window) loses those windows on the web, and the app has to branch on the platform to get them back.

Idea: on the web, put each WindowSpec window inside the one canvas, as a window the app's own code doesn't have to know about. Each one keeps its own state, retained tree, focus and clocks, the same as on the desktop. It's drawn at its placed frame, in z-order, with a title bar the user can drag, resize handles, and focus that follows the click. WindowHandle::placement and close_window keep working. Overlays could go through the same path.

Most of the pieces look like they're already there. The headless --desktop mode (tooling/virtual_desktop.rs) already renders each window into its own texture and composites them in z-order with shadows. The web host would need that live, plus input routing to the window on top and a drag/resize chrome.

For comparison, egui's viewports do this: on platforms without native multi-window support (including the web), they fall back to being drawn as windows inside the main canvas.

Why it matters: one window API for both native and the browser, so a multi-window desktop app also runs in a tab without changes.

Activity

  1. opencodejr commented on Nov 25, 2026

    @opencodejr
    Contributor

    Thanks for the detailed proposal. You've described the current state correctly: WEB.md lists extra windows and overlays as out of scope for the wasm target. The web host (warn_native_window in crates/rune/src/platform/web.rs) ignores window requests, and it only prints the console warning for close, position, place and minimize, not for Open or Show.

    I agree the pieces you point to exist. tooling/virtual_desktop.rs already gives each window its own runtime, state and texture, and composites them in z-order with shadows. But it only runs headless. Running it live on the web would also need:

    • input routing to the window on top, plus focus that follows the click
    • title-bar drag and resize chrome, with its own small state machine
    • WindowHandle::placement and close_window working against the in-canvas frames
    • a decision on how overlays map onto the same path

    I'm tracking this as a feature request and will look at what the change involves. Nothing is committed yet on scope or timing.

  2. opencodejr commented on Nov 25, 2026

    @opencodejr
    Contributor

    I looked at what this would take and didn't open a pull request. It needs a redesign of the web host, not a small patch:

    • One app per page: the web host (platform/web.rs, struct Running) is built around a single Box<dyn WebApp>. Drawing, input routing, the switch from the CPU canvas to WebGPU/WebGL2 (web/handover.rs), on_ready, fonts and page layout all assume that one runtime. It would have to hold several runtimes and draw them all onto the canvas.
    • New windows: open_window queues its spec, but only the native event loop (open_requested in window.rs) starts queued windows. The web host would need its own equivalent, plus WindowHandle placement, close and focus working against the in-canvas frames.
    • Compositing: tooling/virtual_desktop composites windows in z-order, but only headless and offscreen. It isn't wired to the CPU canvas or the WebGL2 fallback, and it handles no live pointer or keyboard input.
    • Window frames: the title bar and resize handles would need a drag/resize state machine (the repo's rule for anything with modes), plus deciding which window gets the click.
    • Accessibility and text input: the DOM accessibility mirror and the hidden textarea used for IME each follow one runtime today. Both would need to follow the focused window.
    • Overlays: they would need a decision on whether they use the same path or stay separate.

    Any of this would also need the headless Chromium proof described in WEB.md. I'm leaving the issue open as a feature request. If you, or whoever takes it on, want to split it up, a reasonable first step is having the web host keep a list of window runtimes and composite them with no frame chrome. Input and chrome could come after that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions