Skip to content

[Bug]: top drag region loses mouse cursor — WebView2 hit-test & SVG cursor workaround needed #527

Description

@HenryYves

Summary

The top drag area of the TouchAI window intermittently loses the mouse pointer. Two distinct WebView2 bugs contribute:

Bug 1 — NCHITTEST misclassification: When no explicit CSS cursor property is set, WebView2 delegates to the Windows NCHITTEST path. This misclassifies the drag region as non-client area (title bar edge), causing Chromium to suppress cursor rendering near the window border.

Bug 2 — CSS cursor rendering failure with no fallback: Even when a CSS cursor IS explicitly set — specifically cursor: url(data:image/svg+xml;base64,...) — WebView2 may silently fail to render the cursor if the data URI fails to decode or load. When this happens, WebView2 does NOT fall back to the specified fallback cursor (e.g., grab / auto). The cursor simply disappears, leaving the user with no visible pointer at all until the page is refreshed.

Fix: Explicit CSS cursor (Bug 1 fix) plus ensuring the fallback cursor is stable (Bug 2 fix). During development, I observed the base64 SVG data URI failing to render intermittently — the cursor would vanish instead of falling back to grab. Once the fallback was corrected and the data URI was validated, the issue resolved.

Important SVG caveat: Chromium/WebView2 does NOT support .svg files directly as cursor: url() values (only Firefox does). Custom SVG cursors must be base64 data URIs — but ensure the encoding is correct and the fallback is reliable.

Reference

Timelog — same Tauri v2 + WebView2 combo, same fix applied:

Steps to reproduce

  1. Open TouchAI on Windows and talk something about it.
  2. Move the cursor to the top edge of the window (the drag region).
  3. Attempt to drag; the cursor either disappears or fails to trigger the drag.
  4. The issue is intermittent but correlates with cursor proximity to the window’s top border.

Expected behavior

The top drag region should always show the appropriate cursor (e.g., default or grab ) and respond to mouse events reliably.

Actual behavior

The cursor intermittently vanishes(Not easily visible).

Affected area

tauri

TouchAI version

v1.2.2

Environment

版本 Windows 11 专业版
版本号 25H2
安装日期 ‎2025/‎10/‎17
操作系统版本 26200.8875
功能包 Windows 功能体验包 1000.26100.334.0

Logs, screenshots, or recordings

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind:bugReproducible bug reportstatus:triageNeeds maintainer triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions