Skip to content
Back to skills

Webview Quirks

ASecurity

Engine and build differences in web-built desktop apps — engine items apply to Tauri and other system-WebView shells, build and dev-server items also apply to Electron — WKWebView on macOS, WebView2 on Windows and WebKitGTK on Linux behave differently; blur and CSS filters are very slow on Linux, DMABUF rendering causes blank windows or crashes on some Linux setups, HTML5 drag and drop breaks on Windows when file-drop handling is on, hidden windows throttle timers, Safari-era APIs land late, ...

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 3, 2026
designrustshellreactnextjsnodeawsapifrontend

Works with

  • api

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned December 3, 2026

npx -y skills add agmmnn/desktop-feel --skill webview-quirks --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Webview Quirks?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Webview Quirks
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/agmmnn-webview-quirks/badge)](https://www.skillsdirectory.com/skills/agmmnn-webview-quirks)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: webview-quirks
description: Engine and build differences in web-built desktop apps — engine items apply to Tauri and other system-WebView shells, build and dev-server items also apply to Electron — WKWebView on macOS, WebView2 on Windows and WebKitGTK on Linux behave differently; blur and CSS filters are very slow on Linux, DMABUF rendering causes blank windows or crashes on some Linux setups, HTML5 drag and drop breaks on Windows when file-drop handling is on, hidden windows throttle timers, Safari-era APIs land late, static-export frameworks break on browser globals or server features, custom browser arguments drop WebView2's defaults, and dark mode doesn't follow the desktop on Linux. Use when something works on one OS and not another, works in Chrome but not in the app, is slow only on Linux, or the dev window is blank.
---

# WebView Quirks

## Initial Response

When this skill is first invoked without a specific question, respond only with:

> Ready to chase an engine difference. Tell me what breaks and on which OS.

A Tauri app is not one browser. It is three engines: WKWebView (Safari's engine) on macOS, WebView2 (Chromium) on Windows, WebKitGTK on Linux. "It works in Chrome DevTools" says only that it works on Windows.

Electron ships one Chromium on every OS, so the engine rules (WQ-01 to WQ-06, WQ-12, WQ-13's engine part) don't apply there. The build and dev-server rules (WQ-07 to WQ-10) and WQ-11 do.

## Hard Rules

1. **Name the engine before fixing.** Get the OS and engine (user agent from the [diagnostic snippet](DIAGNOSE.md)) before changing code.
2. **Feature-detect, never sniff.** `@supports`, `"x" in window`, `CSS.supports()`. Platform branches only for shell-level differences, and from the shell's platform API.
3. **Fix the cause on the engine that needs it.** A Linux-only rendering workaround must not degrade macOS and Windows.

## The Symptom Table

| Problem | Solution | Rule |
| --- | --- | --- |
| Works on one OS only | Test plan per engine | WQ-01 |
| Blur/filters crawl on Linux | Drop or reduce on WebKitGTK | WQ-02 |
| Blank window or crash on Linux | DMABUF workaround | WQ-03 |
| Drag-and-drop sorting dead on Windows | Turn off shell file-drop handling | WQ-04 |
| Timers or animations stop in hidden windows | Background throttling policy | WQ-05 |
| API missing on macOS only | Feature-detect, polyfill | WQ-06 |
| Build fails with "window is not defined" | No browser globals at module scope | WQ-07 |
| API routes / image optimization missing in the build | Static bundle only | WQ-08 |
| The dev window opens blank | The URL the shell loads is fixed | WQ-09 |
| Dev server reloads during every Rust build | Ignore `src-tauri/target` | WQ-10 |
| Window focus/size logic wrong | Ask the shell | WQ-11 |
| Odd WebView2 behavior after adding browser arguments | Keep the default flags | WQ-12 |
| Dark mode ignored or half-applied on Linux | Don't trust the media query alone | WQ-13 |

## The Fixes

### WQ-01 Test in every engine

Minimum: macOS (WKWebView), Windows (WebView2), and the Linux distribution you support (WebKitGTK version matters). Safari Technology Preview approximates WKWebView; it is not the same as running the app.

### WQ-02 Blur and filters on Linux

WebKitGTK has run `filter: blur()` and filter animations through slow CPU paths (WebKit bugs 240865, 252948, 264966); large blurs can drop to seconds per frame. On Linux: remove decorative blur, animate `opacity` instead of `filter: opacity()`, and replace `backdrop-filter` with a solid translucent color.

```css
:root[data-platform="linux"] .glass { backdrop-filter: none; background: var(--panel-bg); }
```

Set `data-platform` from the shell's platform API at startup.

### WQ-03 Linux rendering workaround

On some Linux GPU/driver combinations, WebKitGTK's DMABUF renderer shows a blank window or crashes. The documented workaround is the environment variable `WEBKIT_DISABLE_DMABUF_RENDERER=1`, at the cost of the faster path. Apply it only on Linux (launcher script or `std::env::set_var` before the builder runs) and only if users hit it. See Tauri's "Linux graphics issues" page.

### WQ-04 HTML5 drag and drop on Windows

When the shell handles file drops (`dragDropEnabled`, on by default), HTML5 drag and drop inside the page doesn't work on Windows. If the UI uses HTML5 DnD (sortable lists, kanban), turn it off for that window and handle dropped files with the HTML5 API instead:

```json
{ "app": { "windows": [{ "dragDropEnabled": false }] } }
```

Turning it off hands OS file drops back to the engine, which opens the dropped file in the window unless the page guards against it. Add the document-level drop guard from DN-23 at the same time.

### WQ-05 Background throttling

Engines throttle timers and `requestAnimationFrame` in hidden or minimized windows; WKWebView can suspend the view entirely after a few minutes. If work must continue while hidden (a timer, a recording, a sync), move it to Rust. Tauri's `backgroundThrottling` window policy changes this on macOS only; it is unsupported on Windows and Linux, so it can't be the whole fix.

### WQ-06 Late APIs on macOS

WKWebView follows Safari's release schedule and the user's macOS version. Check support for the oldest macOS you ship, feature-detect, and provide a fallback.

### WQ-07 No browser globals at module scope

SSG/SSR-capable frameworks (Next.js, React Router, Start, Astro, SvelteKit) prerender in Node. Top-level `window`, `document` or `@tauri-apps/api` usage throws at build time. Access them inside effects/`onMount`, or `await import()` them.

### WQ-08 Static bundle only

Tauri serves files; there is no server. SSR, API routes, server actions, ISR and `next/image` optimization don't exist. Next.js needs `output: "export"` and `images.unoptimized: true`. Server logic moves to Rust commands.

### WQ-09 The URL the shell loads is fixed

In development the shell loads one fixed URL: Tauri's `build.devUrl`, or whatever Electron's main process passes to `loadURL`. If the dev server behind that URL picks another port because the default is taken, the window opens blank. Fix that server's port and make it fail instead of moving (`strictPort: true` in Vite).

This rule is only about the server the shell actually loads. Find it first: in Electron, read the `loadURL` call. A dev server the shell never opens (a web-only preview, a frontend served by a local daemon) is not a finding.

### WQ-10 Ignore the Rust build in the dev watcher

```ts
server: { watch: { ignored: ["**/src-tauri/target/**"] } }
```

### WQ-11 Ask the shell

`document.hasFocus()`, `screen.*` and `devicePixelRatio` describe the web view, not the native window (focus across native windows, monitor scale, fullscreen state). Use the shell's window API for window decisions.

### WQ-12 Keep the default browser arguments

On Windows, Tauri starts WebView2 with `--disable-features=msWebOOUI,msPdfOOUI,msSmartScreenProtection`. Setting `additionalBrowserArgs` replaces that string, so those Edge features come back. Merge your flags into the defaults instead of replacing them:

```json
{
  "app": {
    "windows": [{
      "additionalBrowserArgs": "--disable-features=msWebOOUI,msPdfOOUI,msSmartScreenProtection,YourFeature --your-flag"
    }]
  }
}
```

Put all disabled features in one `--disable-features` list. Webviews with different browser arguments must also use different data directories. Windows only.

### WQ-13 Linux dark mode

On Linux, `prefers-color-scheme` doesn't reliably follow the GTK or desktop dark setting, and WebKitGTK only draws dark form controls for pages that declare `color-scheme` (DN-17). An app that themes only from the media query can stay light on a dark desktop, or end up with dark pages and light controls.

1. Declare `color-scheme` on `html` for both themes (DN-17).
2. Offer a Light / Dark / System theme setting in the app, so Linux users can fix it themselves.
3. For System, read the theme from the shell (`getCurrentWindow().theme()` and `onThemeChanged()` in Tauri) and fall back to the media query. **Verify** on GNOME and KDE with the dark setting on; shell theme support on Linux depends on the desktop.

## Output

| Rule | File | Change | Verified |
| --- | --- | --- | --- |

Engine issues are verified on the engine. Say which OS each fix still needs.

Files in this skill

  • DIAGNOSE.md3.3 KB
  • SKILL.md8.1 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in design →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.