Fixes #18557 - Drag & drop difference between Firefox & Chromium browsers#20189
Open
og-khushalpatel wants to merge 1 commit intophpmyadmin:QA_5_2from
Open
Fixes #18557 - Drag & drop difference between Firefox & Chromium browsers#20189og-khushalpatel wants to merge 1 commit intophpmyadmin:QA_5_2from
og-khushalpatel wants to merge 1 commit intophpmyadmin:QA_5_2from
Conversation
…um browsers Signed-off-by: Khushal Patel <khushal.b.patel01@gmail.com>
Contributor
Author
|
Hi @MauricioFauth , I’m following up on this PR in case it got buried. Please let me know if any changes are needed from my side. Thank you! |
williamdes
approved these changes
Mar 17, 2026
Member
williamdes
left a comment
There was a problem hiding this comment.
This looks good
What do you thing @kamil-tekiela and @liviuconcioiu ?
Contributor
|
I'm not very good with JavaScript so I won't review the code but the change looks positive to me. |
Contributor
|
Same here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix the drag-and-drop import overlay being incorrectly activated on Chromium-based browsers (Chrome, Edge, Brave, Opera) when users drag internal page elements such as the phpMyAdmin logo, icons, or links. Firefox is not affected because it does not expose Files in
dataTransfer.typesfor in-page drags.Changes (single file: js/src/drag_drop_import.js)
1. New
internalDomDragflag (property)Added a boolean property
internalDomDragto theDragDropImportobject.Tracks whether the current drag operation was initiated from within the page DOM (i.e., user dragged a page element, not an OS file).
2. New
markInternalDrag(event)methodBound to the dragstart event on document.
Since OS file drags never trigger
dragstarton the page, this reliably distinguishes internal DOM drags from external file drags.3. New
clearInternalDrag()methodResets
internalDomDragtofalse.Bound to
dragendanddropevents to ensure the flag is always cleaned up.4. Rewritten
hasFiles(event)method (core fix)The original one-liner:
was replaced with a multi-layered detection approach:
internalDomDragistrue, returnsfalseimmediately**undefined**types guard: ReturnsfalsewhendataTransfer.typesis undefined.Filestype presence: ReturnsfalseifFilesis not in the types list.falseifapplication/x-moz-nativeimageis present (retained from original logic).falseiftext/uri-listortext/htmlare present — these accompany in-page element drags on Chromium but are absent when dragging real OS files.5. Updated
drop(event)handlerAdded an early
hasFiles()guard at the top of thedrophandler to reject non-file drops cleanly.Added
clearInternalDrag()call at the end of the handler to reset state.6. New event listeners
Fixes #18557
Before submitting pull request, please review the following checklist:
Signed-off-byline as described in our DCO. This ensures that the work you're submitting is your own creation.Demo
Screen.Recording.2026-02-27.200655.mp4