@rivet-health/design-system 3.0.1 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -575,6 +575,9 @@ class LockScrollContextService {
575
575
  this.stack = 0;
576
576
  this.scrollPosition = 0;
577
577
  }
578
+ getContext() {
579
+ return this.stack;
580
+ }
578
581
  pushContext() {
579
582
  return ++this.stack;
580
583
  }
@@ -595,16 +598,18 @@ class LockScrollDirective {
595
598
  }
596
599
  ngOnInit() {
597
600
  if (this.lock) {
598
- const context = this.context.pushContext();
599
- if (context > 0) {
601
+ const oldContext = this.context.getContext();
602
+ const newContext = this.context.pushContext();
603
+ if (oldContext === 0 && newContext === 1) {
600
604
  this.lockScroll();
601
605
  }
602
606
  }
603
607
  }
604
608
  ngOnDestroy() {
605
609
  if (this.lock) {
606
- const context = this.context.popContext();
607
- if (context <= 0) {
610
+ const oldContext = this.context.getContext();
611
+ const newContext = this.context.popContext();
612
+ if (oldContext === 1 && newContext === 0) {
608
613
  this.unlockScroll();
609
614
  }
610
615
  }