Skip to content

Commit

Permalink
[HideBodyVerticalScroll] Fix scrollTop
Browse files Browse the repository at this point in the history
  • Loading branch information
Timur Khazamov committed Feb 13, 2018
1 parent ede77d7 commit be855d2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion components/HideBodyVerticalScroll/HideBodyVerticalScroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,16 @@ export default class HideBodyVerticalScroll extends React.Component<Props> {
};

_restoreStyles = (document: HTMLElement, body: HTMLElement) => {
// Must be before _disposeDocumentStyle
// as it would change after dispose
const scrollTop = body.scrollTop;

if (this._disposeDocumentStyle) {
this._disposeDocumentStyle();
this._disposeDocumentStyle = null;
}

if (this._disposeBodyStyle) {
const scrollTop = body.scrollTop;
this._disposeBodyStyle();
this._disposeBodyStyle = null;
document.scrollTop = scrollTop;
Expand Down

0 comments on commit be855d2

Please sign in to comment.