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

Addressing issue #58 - useWindowAsScrollContainer bug #198

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
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
8 changes: 7 additions & 1 deletion src/SortableContainer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,18 @@ export default function sortableContainer(WrappedComponent, config = {withRef: f
useWindowAsScrollContainer,
} = this.props;

const findScrollTop = () => {
if (this.document.body['scrollTop']) { return this.document.body; }
Copy link

Choose a reason for hiding this comment

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

how about:
if('scrollTop' in this.document.body)

Copy link

Choose a reason for hiding this comment

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

Also, please note that in Chrome scrollTop is present in both but appears to be writeable ONLY in document.documentElement but not in document.body

else if (this.document.documentElement['scrollTop']) { return this.document.documentElement; }
return;
};

this.container = typeof getContainer === 'function'
? getContainer(this.getWrappedInstance())
: findDOMNode(this);
this.document = this.container.ownerDocument || document;
this.scrollContainer = useWindowAsScrollContainer
? this.document.body
? findScrollTop()
: this.container;
this.contentWindow = typeof contentWindow === 'function'
? contentWindow()
Expand Down