Skip to content

Commit

Permalink
fix(cdk): fix scroll blocker for custom withScroll mode (#1364)
Browse files Browse the repository at this point in the history
Closes #1158, Closes #1259
  • Loading branch information
nnixaa authored Apr 10, 2019
1 parent 788a6d4 commit 34193cc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/framework/theme/components/cdk/overlay/_overlay.theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,14 @@
z-index: 1040;
}
}

/**
* In case when Nebular Layout custom scroll `withScroll` mode is enabled
* we need to disable default CDK scroll blocker (@link NbBlockScrollStrategyAdapter) on HTML element
* so that it won't add additional positioning.
*/
.nb-global-scrollblock {
position: static;
width: auto;
overflow: hidden;
}
14 changes: 14 additions & 0 deletions src/framework/theme/components/layout/layout.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,21 @@ export class NbLayoutComponent implements AfterViewInit, OnDestroy {
filter(() => this.withScrollValue),
)
.subscribe((scrollable: boolean) => {
const root = this.document.documentElement;
const scrollBlockClass = 'nb-global-scrollblock';

this.overlayScrollBlock = !scrollable;

/**
* In case when Nebular Layout custom scroll `withScroll` mode is enabled
* we need to disable default CDK scroll blocker (@link NbBlockScrollStrategyAdapter) on HTML element
* so that it won't add additional positioning.
*/
if (!scrollable) {
this.renderer.addClass(root, scrollBlockClass);
} else {
this.renderer.removeClass(root, scrollBlockClass);
}
});

if (isPlatformBrowser(this.platformId)) {
Expand Down

0 comments on commit 34193cc

Please sign in to comment.