fix cover preview overlay staying visible after mobile back gesture (#2958) (#3002)

This commit is contained in:
ACX
2026-02-25 16:41:33 -07:00
committed by GitHub
parent a8c356297c
commit 1b26e125ed
@@ -72,6 +72,7 @@ export class MetadataViewerComponent implements OnInit, OnChanges, AfterViewChec
otherItems$!: Observable<MenuItem[]>;
downloadMenuItems$!: Observable<MenuItem[]>;
bookInSeries: Book[] = [];
@ViewChild(Image) private coverImage?: Image;
@ViewChild('descriptionContent') descriptionContentRef?: ElementRef<HTMLElement>;
isExpanded = false;
isOverflowing = false;
@@ -104,6 +105,12 @@ export class MetadataViewerComponent implements OnInit, OnChanges, AfterViewChec
navigationState$ = this.bookNavigationService.getNavigationState();
ngOnInit(): void {
this.destroyRef.onDestroy(() => this.coverImage?.closePreview());
const onPopState = () => this.coverImage?.closePreview();
window.addEventListener('popstate', onPopState);
this.destroyRef.onDestroy(() => window.removeEventListener('popstate', onPopState));
this.readMenuItems$ = this.book$.pipe(
filter((book): book is Book => book !== null),
map((book): MenuItem[] => {