Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IE 11 fixes for react-sortable-hoc #248

Merged
merged 4 commits into from
Jul 26, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/SortableContainer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ export default function sortableContainer(WrappedComponent, config = {withRef: f
]; // Convert NodeList to Array

clonedFields.forEach((field, index) => {
if (field.type !== 'file' && fields[index]) {
if (field.type !== 'file' && fields[index]) {
field.value = fields[index].value;
}
});
Expand Down Expand Up @@ -513,15 +513,15 @@ export default function sortableContainer(WrappedComponent, config = {withRef: f

updatePosition(e) {
const {lockAxis, lockToContainerEdges} = this.props;

const offset = this.getOffset(e);
const translate = {
x: offset.x - this.initialOffset.x,
y: offset.y - this.initialOffset.y,
};
// Adjust for window scroll
translate.y -= (window.scrollY - this.initialWindowScroll.top);
translate.x -= (window.scrollX - this.initialWindowScroll.left);
translate.y -= (window.scrollY - this.initialWindowScroll.top) || window.pageYOffset;
translate.x -= (window.scrollX - this.initialWindowScroll.left) || window.pageXOffset;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks to me like those two statements are not equivalent.

The first one will take into account the diff between the current scrollY and scrollX values vs the initial scroll value

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated this pr with the correct assignment of our initial scroll values so our diff is accurate when using IE 11.


this.translate = translate;

Expand Down Expand Up @@ -571,8 +571,8 @@ export default function sortableContainer(WrappedComponent, config = {withRef: f
top: this.offsetEdge.top + this.translate.y + deltaScroll.top,
};
const scrollDifference = {
top: (window.scrollY - this.initialWindowScroll.top),
left: (window.scrollX - this.initialWindowScroll.left),
top: (window.scrollY - this.initialWindowScroll.top) || window.pageYOffset,
left: (window.scrollX - this.initialWindowScroll.left) || window.pageXOffset,
};
this.newIndex = null;

Expand Down