mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-26 09:16:03 +03:00
[PR #5175] [MERGED] fix(desktop): prevent navigation on file drops #5092
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#5092
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/hoppscotch/hoppscotch/pull/5175
Author: @CuriousCorrelation
Created: 6/20/2025
Status: ✅ Merged
Merged: 6/20/2025
Merged by: @CuriousCorrelation
Base:
next← Head:fix-desktop-prevent-webview-navigation📝 Commits (1)
9399ae6fix(desktop): prevent navigation on file drops📊 Changes
1 file changed (+65 additions, -1 deletions)
View changed files
📝
packages/hoppscotch-selfhost-web/src/main.ts(+65 -1)📄 Description
This adds drag/drop event listeners to prevent Tauri's WebView from opening files when users accidentally drop files outside of intended drop zone.
This fixes that while preserving drag/drop functionality in rest of the inputs like vuedraggable components, file uploads, and code editors (CodeMirror), "browse", etc.
Closes HFE-886
Closes #5089
This occurred because Tauri's WebView inherits standard browser behavior of opening dropped files when they land outside of components designed to handle them.
The current impl uses event listeners that simply skip legitimate drop targets via selectors. The allowed list is made by checking against known patterns from the codebase, things like vuedraggable with
.draggable-contentand[draggable="true"], file upload inputs usinginput[type="file"]and.file-chips-container, code editors with.cm-editorand.ace_editor, plus future-proof selectors like[data-allow-drop]and.drop-zonefor new components (planned with portable).How it works
Navigation prevention on reordering
https://github.com/user-attachments/assets/cd91be10-ad6c-466e-8cd9-7e892b7d7878
Navigation prevention on file drop
https://github.com/user-attachments/assets/71d2b8bd-6fdf-43b8-b20d-4892b4a5186e
Notes to reviewers
This change only affects desktop mode when
kernelMode === "desktop"and preserves all existing functionality.Testing should verify that all existing drag/drop functionality works, file uploads in multipart form data components, bulk editor drag/drop in CodeMirror instances, and header/parameter drag reordering.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.