Skip to content
This repository has been archived by the owner on Dec 24, 2023. It is now read-only.

Commit

Permalink
fix: add overflow to body instead of html
Browse files Browse the repository at this point in the history
  • Loading branch information
wswebcreation committed May 26, 2019
1 parent 9dbe93b commit 5991a88
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/clientSideScripts/hideScrollbars.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import hideScrollBars from './hideScrollbars';

describe('hideScrollBars', ()=>{
it('should be able to hide and show the scrollbars', ()=>{
expect(document.documentElement.style.overflow).toMatchSnapshot();
expect(document.body.style.overflow).toMatchSnapshot();

hideScrollBars(true);

expect(document.documentElement.style.overflow).toMatchSnapshot();
expect(document.body.style.overflow).toMatchSnapshot();

hideScrollBars(false);

expect(document.documentElement.style.overflow).toMatchSnapshot();
expect(document.body.style.overflow).toMatchSnapshot();
});
});
4 changes: 2 additions & 2 deletions lib/clientSideScripts/hideScrollbars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
*/
export default function hideScrollBars(hide: boolean): void {
if (hide) {
document.documentElement.style.overflow = 'hidden';
document.body.style.overflow = 'hidden';
} else {
document.documentElement.style.overflow = '';
document.body.style.overflow = '';
}
}

0 comments on commit 5991a88

Please sign in to comment.