Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Cancelling drag & drop with the escape key does not fire cancellation #10126

Open
keehun opened this issue Jun 26, 2024 · 0 comments
Open
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@keehun
Copy link

keehun commented Jun 26, 2024

Describe the bug

When I am in the middle of a drag & drop operation (dragging in a file outside of the app into the app), if I click the Escape key to cancel the drag & drop before I actually drop the file, the onDragDropEvent() handler will not get an event for that cancellation.

See this console log output as an example:
Screenshot 2024-06-25 at 21 57 43

The first line shows my onDragDropEvent() handler registering the dragged event. The second line appears when I click the Escape key.

The referenced line in the stack trace, webview.js:481 is the following:
Screenshot 2024-06-25 at 21 59 30

I wonder if position should allowed to be null/undefined and/or always report the last-known point if unknown.

P.S. I only tested this on macOS, but I imagine that behavior would be similar on Windows and Linux?

Reproduction

  1. Set up a very basic Tauri app with:
import { getCurrent } from "@tauri-apps/api/webview";
<...>
await getCurrent().onDragDropEvent((event) => {
    console.log(event)
}
  1. Drag in a file. Notice the initial drag-on event firing.
  2. Before dropping the file, press the Escape key to cancel the drag & drop.

Expected behavior

Another event should fire with the cancellation information.

Full tauri info output

$ tauri info

[✔] Environment
    - OS: Mac OS 14.4.0 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.79.0 (129f3b996 2024-06-10)
    ✔ cargo: 1.79.0 (ffa9cf99a 2024-06-03)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (default)
    - node: 21.5.0
    - npm: 10.2.4
    - bun: 1.1.15

[-] Packages
    - tauri [RUST]: 2.0.0-beta.22
    - tauri-build [RUST]: 2.0.0-beta.17
    - wry [RUST]: 0.40.1
    - tao [RUST]: 0.28.1
    - @tauri-apps/api : not installed!
    - @tauri-apps/cli [NPM]: 2.0.0-beta.20

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../build
    - devUrl: http://localhost:1420/
    - framework: Svelte
    - bundler: Vite

Stack trace

[Error] TypeError: null is not an object (evaluating 'event.payload.position')
	(anonymous function) (webview.js:481)
	value (user-script:5:227)
	value (user-script:5:299)
	(anonymous function) (Script Element 16:1:91)
	Global Code (Script Element 16:1:173)

Additional context

No response

@keehun keehun added status: needs triage This issue needs to triage, applied to new issues type: bug labels Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

1 participant