Skip to content

fix(desktop-shell): allow Windows HTML5 drag/drop in WebView2 - #1140

Closed
hhucz wants to merge 3 commits into
BytePioneer-AI:mainfrom
hhucz:feat/windows-shell-html5-dnd
Closed

hhucz wants to merge 3 commits into
BytePioneer-AI:mainfrom
hhucz:feat/windows-shell-html5-dnd

Conversation

@hhucz

@hhucz hhucz commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Split out as an independent PR (PR3) per maintainer feedback on #1122 to address only the Windows native Shell HTML5 drag-and-drop boundary:

  • Modify only apps/desktop-shell/src-tauri/src/lib.rs based on latest upstream/main.
  • Add .disable_drag_drop_handler() inside the #[cfg(target_os = "windows")] WebviewWindowBuilder chain so macOS and Linux are completely unaffected.
  • Contains no section management, Web Server, Host Runtime, or zoom changes.

No visual changes: this PR adjusts only the Windows Tauri WebviewWindowBuilder drag-and-drop handler boundary in apps/desktop-shell/src-tauri/src/lib.rs without changing UI layout or styling.

Validation

  • cargo +1.97.1-x86_64-pc-windows-gnu fmt --manifest-path apps/desktop-shell/src-tauri/Cargo.toml --check — passed.
  • cargo +1.97.1-x86_64-pc-windows-gnu check --manifest-path apps/desktop-shell/src-tauri/Cargo.toml --locked — passed (via C:/Users/cz/.cargo/bin + GNU toolchain).
  • cargo +1.97.1-x86_64-pc-windows-gnu test --manifest-path apps/desktop-shell/src-tauri/Cargo.toml --locked --lib — 9 passed, 0 failed (linked tauri-winres's generated libresource.a via RUSTFLAGS="-C link-arg=..." so the --lib test binary carries the comctl32 v6 manifest required by TaskDialogIndirect on Windows).

Validation Boundaries & Not Verified

  • MSVC toolchain (x86_64-pc-windows-msvc): not verified locally.
  • Real Windows Desktop Shell GUI runtime: not tested in a live WebView2 window; the following interactive drag-and-drop flows are not runtime-verified here:
    • Session/Thread reference drag-and-drop (dragging a Thread onto the composer).
    • Section drag-and-drop (dragging Threads across/within sidebar sections; section feature changes are out of scope for this PR).
    • External file attachment drag-and-drop (dragging files from Windows Explorer into the Web UI).
  • macOS / Linux: not built or tested locally (guarded out via #[cfg(target_os = "windows")]).

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • 功能调整
    • Windows 桌面主窗口不再处理拖放操作;无边框和阴影显示保持不变。此变化仅涉及窗口对拖放行为的响应,不影响窗口外观设置。

Windows 主窗口配置禁用拖放处理器。原生 Web 打开测试为临时目录删除操作增加重试配置。更新设置页面统一渲染错误详情。更新管理器测试调整重命名尝试次数的断言时点。

Changes: Windows 主窗口配置

Layer / File(s) Summary
主窗口拖放配置
apps/desktop-shell/src-tauri/src/lib.rs
Windows 窗口构建器新增 .disable_drag_drop_handler()。

原生 Web 打开测试清理

Layer / File(s) Summary
临时目录删除重试
packages/host-runtime/test/native/web-open.test.ts
删除临时目录时配置最多重试 10 次,每次间隔 100 毫秒。

更新设置错误详情

Layer / File(s) Summary
错误详情统一渲染
packages/renderer-extension/src/settings/pages.ts
新增 appendErrorDetail,忽略空详情;更新失败状态和检查错误改为通过该 helper 渲染错误段落。

更新管理器重试测试

Layer / File(s) Summary
重命名尝试时序断言
packages/update-manager/test/update-manager.test.ts
测试记录 prefetchNpm 执行时的重命名尝试次数,并断言当时已发生 3 次尝试。

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested reviewers: bytepioneer-ai

Merge Risk: Minimal · up to 1f630

The change enables HTML5 drag-and-drop in the Windows WebView2 window and includes small test and settings-page cleanups. No merge-blocking risk was found. Windows GUI behavior was not exercised by the author.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed 标题“fix(desktop-shell): allow Windows HTML5 drag/drop in WebView2”指出了主要变更:在 Windows 桌面壳的 WebView2 中允许 HTML5 拖放。变更摘要显示 lib.rs 在 Windows 分支新增 .disable_drag_drop_handler(),与标题一致。摘要中还包含其他文件的变更(测试清理重试、设置页错误…
Description check Passed 描述说明了本 PR 的范围(仅修改 apps/desktop-shell/src-tauri/src/lib.rs 中 Windows 分支的 WebviewWindowBuilder 拖放处理),列出了验证命令、结果以及未验证的范围。该描述与变更集中的主要改动相关。描述未提及其他文件的变更(测试清理重试、设置页错误详情 helper、更新管理器测试),这与摘要中的多文件变更存在不一致,但该问题不…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

标题“fix(desktop-shell): allow Windows HTML5 drag/drop in WebView2”指出了主要变更:在 Windows 桌面壳的 WebView2 中允许 HTML5 拖放。变更摘要显示 lib.rs 在 Windows 分支新增 .disable_drag_drop_handler(),与标题一致。摘要中还包含其他文件的变更(测试清理重试、设置页错误详情 helper、更新管理器测试),标题未涵盖这些部分,但这属于次要内容,标题仍与主要变更相关。

Full details: Description check

Explanation

描述说明了本 PR 的范围(仅修改 apps/desktop-shell/src-tauri/src/lib.rs 中 Windows 分支的 WebviewWindowBuilder 拖放处理),列出了验证命令、结果以及未验证的范围。该描述与变更集中的主要改动相关。描述未提及其他文件的变更(测试清理重试、设置页错误详情 helper、更新管理器测试),这与摘要中的多文件变更存在不一致,但该问题不影响描述与变更集的相关性判断。

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 971a677 and 1f63012.

Files selected for processing: 2

  • packages/renderer-extension/src/settings/pages.ts
  • packages/update-manager/test/update-manager.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Recent review details

Context from checks skipped due to timeout: 8

  • GitHub Check: CodeRabbit
  • GitHub Check: Check macos-26
  • GitHub Check: Static checks
  • GitHub Check: Check Linux ARM64
  • GitHub Check: Check windows-latest
  • GitHub Check: Web Host tests
  • GitHub Check: Check ubuntu-22.04
  • GitHub Check: Vitest
Additional context used

Code guidelines: 2

CLAUDE.md — auto-discovered
AGENTS.md — auto-discovered
Path-based instructions: 2

Source excerpt: `renderer-extension` must not import Node.js built-ins, Electron private APIs, or Harness SDKs.

CodeRabbit inference engine (CLAUDE.md)

Files:

  • packages/renderer-extension/src/settings/pages.ts
Source excerpt: Use package public exports for cross-package dependencies.

CodeRabbit inference engine (AGENTS.md)

Files:

  • packages/renderer-extension/src/settings/pages.ts
  • packages/update-manager/test/update-manager.test.ts

hhucz and others added 3 commits November 25, 2026 16:09
Call `.disable_drag_drop_handler()` inside the `#[cfg(target_os = "windows")]`
`WebviewWindowBuilder` chain in `apps/desktop-shell/src-tauri/src/lib.rs` so
Tauri/WebView2's native drop handler does not intercept HTML5 drag-and-drop
events destined for the Web UI, while keeping macOS and Linux unchanged.

Co-Authored-By: Claude Code <[email protected]>
Restore detailed update failures and count only rename attempts for the downloading status in the Windows retry test.

Co-Authored-By: Kimi <[email protected]>
@iruriQ

iruriQ commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Thank you for flagging and fixing WebView2 drag-and-drop! origin/main has since landed f3b1e5382 enabling .disable_drag_drop_handler() across all platforms (and 8e66f0dd7 covered the pages.ts / update-manager.test.ts fixes), so this PR is now superseded. Closing with thanks!

@iruriQ iruriQ closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants