From 30ad883c9e3b37dcff5452ecf97301c4a6fb3084 Mon Sep 17 00:00:00 2001 From: Dinh Nguyen Date: Tue, 31 Dec 2024 17:38:29 +0700 Subject: [PATCH] handle feedback --- .../product-detail-version-action.component.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/marketplace-ui/src/app/modules/product/product-detail/product-detail-version-action/product-detail-version-action.component.ts b/marketplace-ui/src/app/modules/product/product-detail/product-detail-version-action/product-detail-version-action.component.ts index c48d46b4..be89c45d 100644 --- a/marketplace-ui/src/app/modules/product/product-detail/product-detail-version-action/product-detail-version-action.component.ts +++ b/marketplace-ui/src/app/modules/product/product-detail/product-detail-version-action/product-detail-version-action.component.ts @@ -283,11 +283,13 @@ export class ProductDetailVersionActionComponent implements AfterViewInit { @HostListener('document:click', ['$event']) handleClickOutside(event: MouseEvent): void { - if (!this.elementRef.nativeElement - .querySelector('#download-dropdown-menu') - .contains(event.target) - && - this.isDropDownDisplayed() + const downloadDialog = this.elementRef.nativeElement.querySelector( + '#download-dropdown-menu' + ); + if ( + this.isDropDownDisplayed() && + downloadDialog && + !downloadDialog.contains(event.target) ) { this.isDropDownDisplayed.set(!this.isDropDownDisplayed()); }