Skip to content

Commit

Permalink
Fixed double onClick event on parent element
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronbeall committed Nov 9, 2016
1 parent 68f39d7 commit 00d4045
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/index.js
Expand Up @@ -17,6 +17,7 @@ class Dropzone extends React.Component {
this.onDragOver = this.onDragOver.bind(this);
this.onDrop = this.onDrop.bind(this);
this.onFileDialogCancel = this.onFileDialogCancel.bind(this);
this.onInputClick = this.onInputClick.bind(this);
this.fileAccepted = this.fileAccepted.bind(this);
this.isFileDialogActive = false;
this.state = {
Expand Down Expand Up @@ -144,6 +145,10 @@ class Dropzone extends React.Component {
this.open();
}
}

onInputClick(e) {
e.stopPropagation();
}

onFileDialogCancel() {
// timeout will not recognize context of this method
Expand Down Expand Up @@ -291,6 +296,7 @@ class Dropzone extends React.Component {
<input
{...inputProps/* expand user provided inputProps first so inputAttributes override them */}
{...inputAttributes}
onClick={this.onInputClick}
/>
</div>
);
Expand Down

0 comments on commit 00d4045

Please sign in to comment.