Skip to content

[stable13] Fix highlighting of the upload drop zone - #9837

Merged
rullzer merged 5 commits into
stable13from
stable13-9807-fix-highlighting-of-the-upload-drop-zone
Jun 13, 2018
Merged

[stable13] Fix highlighting of the upload drop zone#9837
rullzer merged 5 commits into
stable13from
stable13-9807-fix-highlighting-of-the-upload-drop-zone

Conversation

@danxuliu

Copy link
Copy Markdown
Member

Backport of #9807

"disableDropState" was set as the event handler in 8d4e574, but
the duplicated code was accidentally added back in 786e858.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
The jQuery Plugin triggers the "dragover" callback when the browser
triggers the "dragover" event and the types in their DataTransfer
include a "Files" item. It also triggers the "drop" callback when the
browser triggers the "drop" event and the list of files in its
DataTransfer is not empty.
Unfortunately some browsers may trigger "dragover" events with a
DataTransfer that includes a "Files" item and then trigger a "drop"
event with an empty list of files. When that happens the actions
performed in the "dragXXX" callbacks could be left hanging if they were
expected to be finished in the "drop" callback (for example, if the drop
zone was highlighted during the drag to be then restored when the file
was finally dropped). This commit adds the "dropnofiles" callback to be
able to handle those situations.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
When a file is dragged from the desktop to the file list the file list
is highlighted, and when the file is finally dropped or the drag
operation is cancelled the highlighting is removed. In some cases, due
to a wrong implementation, a browser may end a file drag with a drop
with no files (for example, when a folder or text is dragged), which
would cause the highlight to not be removed. Now those cases are handled
with the "dropnofiles" callback, which restores the UI and also shows a
message to the user.
The error message is just a generic one, as in some cases it is not even
possible to know whether the problem came from a text drag or a folder
drag, and whether the problem appears or not depends on the browser,
version and even operating system.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
The highlighting was removed in Firefox when the cursor was no longer
moving to handle the behaviour of reporting a file drag and then
providing no files in the drop event. That behaviour (which was only
present in Firefox 48 and 49) is already handled with the "dropnofiles"
callback, so that special handling is no longer needed.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
When the browser reports a drag of items other than files (for example,
text) and then triggers a drop event with no files no error message
should be shown to the user, as in that case there would be no highlight
of the drop zone and no indication that the drop would be valid (except
for the mouse cursor); the error message should be shown only when
the drop event with no files follows a file drag.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
@codecov

codecovBot commented Jun 12, 2018

Copy link
Copy Markdown

Codecov Report

Merging #9837 into stable13 will not change coverage.
The diff coverage is n/a.

@@ Coverage Diff @@## stable13 #9837 +/- ##
===========================================
Coverage 51.43% 51.43% Complexity 25135 25135 ===========================================
Files 1613 1613 Lines 95626 95626 Branches 1376 1376 ===========================================
Hits 49190 49190 Misses 46436 46436
Impacted FilesCoverage ΔComplexity Δ
apps/files_trashbin/lib/Expiration.php90.32% <0%> (-1.62%)29% <0%> (ø)
apps/files_trashbin/lib/Trashbin.php72.53% <0%> (+0.24%)136% <0%> (ø)⬇️

@rullzerrullzer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐘

@rullzer
rullzer merged commit 0fa82e5 into stable13Jun 13, 2018
@rullzer
rullzer deleted the stable13-9807-fix-highlighting-of-the-upload-drop-zone branch June 13, 2018 06:30
@MorrisJobkeMorrisJobke mentioned this pull request Jul 10, 2018
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@danxuliu@rullzer@skjnldsv