From 3da58e1752460ef2f95329dd45b3072daedee9b2 Mon Sep 17 00:00:00 2001 From: Jason Ng Date: Tue, 8 Jul 2025 10:51:02 -0400 Subject: [PATCH] [PM-23352] fix extra large spacing in height of intro carousel (#15512) --- .../src/components/carousel/carousel.component.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/libs/vault/src/components/carousel/carousel.component.ts b/libs/vault/src/components/carousel/carousel.component.ts index 275b9de4fc..f2d211697d 100644 --- a/libs/vault/src/components/carousel/carousel.component.ts +++ b/libs/vault/src/components/carousel/carousel.component.ts @@ -6,15 +6,19 @@ import { ChangeDetectorRef, Component, ContentChildren, + DestroyRef, ElementRef, EventEmitter, inject, Input, + NgZone, Output, QueryList, ViewChild, ViewChildren, } from "@angular/core"; +import { takeUntilDestroyed } from "@angular/core/rxjs-interop"; +import { take } from "rxjs"; import { ButtonModule } from "@bitwarden/components"; @@ -44,7 +48,7 @@ export class VaultCarouselComponent implements AfterViewInit { @Input({ required: true }) label = ""; /** - * Emits the index of of the newly selected slide. + * Emits the index of the newly selected slide. */ @Output() slideChange = new EventEmitter(); @@ -82,6 +86,11 @@ export class VaultCarouselComponent implements AfterViewInit { */ protected keyManager: FocusKeyManager | null = null; + constructor( + private ngZone: NgZone, + private destroyRef: DestroyRef, + ) {} + /** Set the selected index of the carousel. */ protected selectSlide(index: number) { this.selectedIndex = index; @@ -97,7 +106,9 @@ export class VaultCarouselComponent implements AfterViewInit { // Set the first carousel button as active, this avoids having to double tab the arrow keys on initial focus. this.keyManager.setFirstItemActive(); - await this.setMinHeightOfCarousel(); + this.ngZone.onStable.pipe(take(1), takeUntilDestroyed(this.destroyRef)).subscribe(() => { + void this.setMinHeightOfCarousel(); + }); } /**