fix(ui): prevent album overlay clicks from navigating
This commit is contained in:
1 parent
cb617a5c2c
commit
44293b3b40
1 file changed
+10
-1
@@ -81,6 +81,15 @@
|
|||||||
onPlay?.();
|
onPlay?.();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isOverlayAction(target: EventTarget | null) {
|
||||||
|
return target instanceof HTMLElement && !!target.closest('.action-buttons');
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleCardClick(event: MouseEvent) {
|
||||||
|
if (isOverlayAction(event.target)) return;
|
||||||
|
onclick?.();
|
||||||
|
}
|
||||||
|
|
||||||
function updateOverflow() {
|
function updateOverflow() {
|
||||||
if (titleRef && titleTextRef) {
|
if (titleRef && titleTextRef) {
|
||||||
const overflow = titleTextRef.scrollWidth - titleRef.clientWidth;
|
const overflow = titleTextRef.scrollWidth - titleRef.clientWidth;
|
||||||
@@ -130,7 +139,7 @@
|
|||||||
<div
|
<div
|
||||||
class="album-card"
|
class="album-card"
|
||||||
style="width: {cardSize}px"
|
style="width: {cardSize}px"
|
||||||
onclick={onclick}
|
onclick={handleCardClick}
|
||||||
role="button"
|
role="button"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
onkeydown={(e) => e.key === 'Enter' && onclick?.()}
|
onkeydown={(e) => e.key === 'Enter' && onclick?.()}
|
||||||
|
|||||||
Reference in new issue
Block a user