From 504b02785427a4304a7694ade77506bdf62f30fb Mon Sep 17 00:00:00 2001 From: Dermot Duffy Date: Sat, 21 Feb 2026 11:17:07 -0800 Subject: [PATCH] fix: Fix off-by-one thumbnail for folder media (#2364) - Closes: https://github.com/dermotduffy/advanced-camera-card/issues/2326 --- src/components/thumbnail-carousel.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/thumbnail-carousel.ts b/src/components/thumbnail-carousel.ts index 215b4b20..514b0324 100644 --- a/src/components/thumbnail-carousel.ts +++ b/src/components/thumbnail-carousel.ts @@ -128,9 +128,13 @@ export class AdvancedCameraCardThumbnailCarousel extends LitElement { } private _getSelectedSlide(): number | null { - return ( - this.viewManagerEpoch?.manager.getView()?.queryResults?.getSelectedIndex() ?? null - ); + const view = this.viewManagerEpoch?.manager.getView(); + const selectedIndex = view?.queryResults?.getSelectedIndex() ?? null; + if (selectedIndex === null) { + return null; + } + const hasUpFolder = !!getUpFolderItem(view?.query); + return hasUpFolder ? selectedIndex + 1 : selectedIndex; } private _handleMediaClick(item: ViewMedia): void {