diff --git a/js/components/ascribe_uploader/file_drag_and_drop.js b/js/components/ascribe_uploader/file_drag_and_drop.js index 96347157..3998eff1 100644 --- a/js/components/ascribe_uploader/file_drag_and_drop.js +++ b/js/components/ascribe_uploader/file_drag_and_drop.js @@ -4,8 +4,10 @@ import React from 'react'; import FileDragAndDropPreviewIterator from './file_drag_and_drop_preview_iterator'; +let ReactTestUtils = React.addons.TestUtils; + // Taken from: https://github.com/fedosejev/react-file-drag-and-drop -var FileDragAndDrop = React.createClass({ +let FileDragAndDrop = React.createClass({ propTypes: { className: React.PropTypes.string, onDragStart: React.PropTypes.func, @@ -116,10 +118,16 @@ var FileDragAndDrop = React.createClass({ return; } - // Simulate click on hidden file input - var event = document.createEvent('HTMLEvents'); - event.initEvent('click', false, true); - this.refs.fileinput.getDOMNode().dispatchEvent(event); + // Firefox only recognizes the simulated mouse click if bubbles is set to true, + // but since Google Chrome propagates the event much further than needed, we + // need to stop propagation as soon as the event is created + var evt = new MouseEvent("click", { + view: window, + bubbles: true, + cancelable: true, + }); + evt.stopPropagation(); + this.refs.fileinput.getDOMNode().dispatchEvent(evt); }, render: function () { diff --git a/js/components/ascribe_uploader/file_drag_and_drop_preview.js b/js/components/ascribe_uploader/file_drag_and_drop_preview.js index 5fbae1ca..64600b9d 100644 --- a/js/components/ascribe_uploader/file_drag_and_drop_preview.js +++ b/js/components/ascribe_uploader/file_drag_and_drop_preview.js @@ -32,7 +32,6 @@ let FileDragAndDropPreview = React.createClass({ // don't run it // On the other hand, if the files progress is not yet at a 100%, // just run fineuploader.cancel - console.log(this.props.file); if(this.props.handleDeleteFile && this.props.file.progress === 100) { this.props.handleDeleteFile(this.props.file.id); } else if(this.props.handleCancelFile && this.props.file.progress !== 100) {