Skip to content

Commit

Permalink
fix: Move Firefox anchor tag fix inside handleStart (clauderic#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
clauderic committed Jan 17, 2017
1 parent 0bf40ca commit 308b1bb
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/SortableContainer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,15 @@ export default function sortableContainer(WrappedComponent, config = {withRef: f

this.manager.active = {index, collection};

/*
* Fixes a bug in Firefox where the :active state of anchor tags
* prevent subsequent 'mousemove' events from being fired
* (see https://github.com/clauderic/react-sortable-hoc/issues/118)
*/
if (e.target.tagName.toLowerCase() === 'a') {
e.preventDefault();
}

if (!distance) {
if (this.props.pressDelay === 0) {
this.handlePress(e);
Expand Down Expand Up @@ -180,15 +189,6 @@ export default function sortableContainer(WrappedComponent, config = {withRef: f
const containerBoundingRect = this.container.getBoundingClientRect();
const dimensions = getHelperDimensions({index, node, collection});

/*
* Fixes a bug in Firefox where the :active state of anchor tags
* prevent subsequent 'mousemove' events from being fired
* (see https://github.com/clauderic/react-sortable-hoc/issues/118)
*/
if (e.target.tagName.toLowerCase() === 'a') {
e.preventDefault();
}

this.node = node;
this.margin = margin;
this.width = dimensions.width;
Expand Down

0 comments on commit 308b1bb

Please sign in to comment.