Closed zedtux closed 7 years ago
Have upgraded to latest version from git master and encountering the same issue (it wasn't occurring before).
Different browsers give different errors though, so to help others find this issue...
Firefox too much recursion jquery-migrate-1.2.1.min.js Line 2
IE 11 SCRIPT28: Out of stack space File: jquery-2.0.3.min.js, Line: 5, Column: 8326
With the file field outside the drop-zone, but a button inside that triggers it, the click event still fires twice:
<button class="button btn btn-primary" onclick="$('#file_uploader').click();" type="button">Select Files</button>
The solution to that being to stop the propagation in that onclick event:
onclick="event.stopPropagation();$('#file_uploader').click();"
Preventing the original infinite recursion should probably be done by fixing the function on lines 84..86 - to be something like:
this.on('click', function(e){
if ( e.originalEvent.originalTarget.id == opts.fallback_id )
return;
$('#' + opts.fallback_id).trigger(e);
});
(untested)
It might also be useful to have a setting which triggers whether this new on click is called at all:
if ( opts.fallback_click_anywhere === true )
{
this.on('click', function(e){
if ( e.originalEvent.originalTarget.id == 'opts.fallback_id' )
return;
$('#' + opts.fallback_id).trigger(e);
});
}
Which would be an easier way to fix the firing twice issue, for anyone with lots of upload controls/buttons but the settings defined in a single place.
Hello,
First of all, this is a very nice plugin ! :+1:
I have discovered the following bug:
The issue is that clicking the HTML element fire the
click
event of jquery-filedrop AND theclick
event of the file field.Moving it out of the dropzone HTML element solve the issue.