File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ export class CdkStickyHeader implements OnDestroy, AfterViewInit {
6060 public element : HTMLElement ;
6161
6262 // the upper container element with the 'cdkStickyRegion' tag
63- public stickyParent : HTMLElement ;
63+ public stickyParent : HTMLElement | null ;
6464 public upperScrollableContainer : HTMLElement ;
6565
6666 /**
@@ -147,6 +147,9 @@ export class CdkStickyHeader implements OnDestroy, AfterViewInit {
147147 * when to start, when to finish)
148148 */
149149 defineRestrictions ( ) : void {
150+ if ( this . stickyParent == null ) {
151+ return ;
152+ }
150153 let containerTop : any = this . stickyParent . getBoundingClientRect ( ) ;
151154 let elemHeight : number = this . element . offsetHeight ;
152155 let containerHeight : number = this . getCssNumber ( this . stickyParent , 'height' ) ;
@@ -225,6 +228,10 @@ export class CdkStickyHeader implements OnDestroy, AfterViewInit {
225228 unstuckElement ( ) : void {
226229 this . isStuck = false ;
227230
231+ if ( this . stickyParent == null ) {
232+ return ;
233+ }
234+
228235 this . element . classList . add ( STICK_END_CLASS ) ;
229236 this . stickyParent . style . position = 'relative' ;
230237 let unstuckCss : any = {
You can’t perform that action at this time.
0 commit comments