fix(ui): prevent mobile touch events from triggering playback after lightbox close

Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
Deluan
2026-03-14 21:47:26 -04:00
parent 549b812633
commit 197d357f02
+11 -1
View File
@@ -85,7 +85,14 @@ const DiscSubtitleRow = forwardRef(
const classes = useStyles({ isDesktop })
const [imageError, setImageError] = useState(false)
const [isLightboxOpen, setLightboxOpen] = useState(false)
const lightboxClosedAt = React.useRef(0)
const handlePlaySubset = (discNumber) => () => {
// Ignore clicks shortly after the lightbox was closed to prevent
// mobile touch events from "falling through" the overlay and
// triggering playback.
if (Date.now() - lightboxClosedAt.current < 400) {
return
}
onClick(discNumber)
}
@@ -112,7 +119,10 @@ const DiscSubtitleRow = forwardRef(
[imageError],
)
const handleCloseLightbox = useCallback(() => setLightboxOpen(false), [])
const handleCloseLightbox = useCallback(() => {
lightboxClosedAt.current = Date.now()
setLightboxOpen(false)
}, [])
const subtitle = record.discSubtitle
? record.discSubtitle