Skip to content

Commit

Permalink
Fix scrolling when dragging
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Mar 30, 2018
1 parent 4a817c5 commit 7dcc860
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions components/drop-zone/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { isEqual, find, some, filter, noop, throttle } from 'lodash';
/**
* WordPress dependencies
*/
import { Component } from '@wordpress/element';
import { Component, findDOMNode } from '@wordpress/element';

class DropZoneProvider extends Component {
constructor() {
Expand All @@ -17,7 +17,6 @@ class DropZoneProvider extends Component {
this.dragOverListener = this.dragOverListener.bind( this );
this.isWithinZoneBounds = this.isWithinZoneBounds.bind( this );
this.onDrop = this.onDrop.bind( this );
this.bindContainer = this.bindContainer.bind( this );

this.state = {
isDraggingOverDocument: false,
Expand All @@ -27,10 +26,6 @@ class DropZoneProvider extends Component {
this.dropzones = [];
}

bindContainer( ref ) {
this.container = ref;
}

dragOverListener( event ) {
this.toggleDraggingOverDocument( event, this.getDragEventType( event ) );
event.preventDefault();
Expand All @@ -53,6 +48,7 @@ class DropZoneProvider extends Component {
window.addEventListener( 'dragover', this.dragOverListener );
window.addEventListener( 'drop', this.onDrop );
window.addEventListener( 'mouseup', this.resetDragState );
this.container = findDOMNode( this );
}

componentWillUnmount() {
Expand Down Expand Up @@ -225,7 +221,7 @@ class DropZoneProvider extends Component {

render() {
const { children } = this.props;
return <div ref={ this.bindContainer }>{ children }</div>;
return children;
}
}

Expand Down

0 comments on commit 7dcc860

Please sign in to comment.