From 886aa551f82bbd2b267736a4a7a010ffcaa45be1 Mon Sep 17 00:00:00 2001 From: IRHM <37304121+IRHM@users.noreply.github.com> Date: Sun, 13 Oct 2024 13:50:43 +0100 Subject: [PATCH] GamePoster: Fix focus lost issue on rating/status via quick btns --- src/lib/poster/GamePoster.svelte | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib/poster/GamePoster.svelte b/src/lib/poster/GamePoster.svelte index 857a1616..20ce65f6 100644 --- a/src/lib/poster/GamePoster.svelte +++ b/src/lib/poster/GamePoster.svelte @@ -41,6 +41,8 @@ // If poster is active (scaled up) let posterActive = false; + // If mouse in on poster. Added to fix #656. + let mouseOverPoster = false; let containerEl: HTMLDivElement; let bhCanvas: HTMLCanvasElement; @@ -72,7 +74,6 @@ } function handleInnerKeyUp(e: KeyboardEvent) { - console.log(e.target); if (e.key === "Enter" && (e.target as HTMLElement)?.id === "ilikemoviessueme") { if (typeof onClick !== "undefined") { onClick(); @@ -122,6 +123,7 @@
  • { + mouseOverPoster = true; if (!posterActive) calculateTransformOrigin(e); if (!isTouch()) { posterActive = true; @@ -134,12 +136,15 @@ } }} on:focusout={() => { - if (!isTouch()) { + if (!isTouch() && !mouseOverPoster) { // Only on !isTouch (to match focusin) to avoid breaking a tap and hold on link on mobile. + // and only if mouse isn't still over the poster, fixes focusout on click of rating/status + // poster buttons causing poster to shrink until refocused with click/mouse out & in again. posterActive = false; } }} on:mouseleave={() => { + mouseOverPoster = false; posterActive = false; const ae = document.activeElement; if (