Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GamePoster: Fix focus lost issue on rating/status via quick btns #659

Merged
merged 1 commit into from
Oct 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/lib/poster/GamePoster.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -122,6 +123,7 @@
<!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
<li
on:mouseenter={(e) => {
mouseOverPoster = true;
if (!posterActive) calculateTransformOrigin(e);
if (!isTouch()) {
posterActive = true;
Expand All @@ -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 (
Expand Down