From f8ec7e427d254180f9dc8ac5e6006ab3ee558de1 Mon Sep 17 00:00:00 2001 From: Yohan Boujon Date: Tue, 30 Jan 2024 23:25:41 +0100 Subject: [PATCH] Frontend: Fixing popup not showing if the button is not aligned with the popup (calling leavingPopup prematurly). --- frontend/src/lib/components/projects-popup.svelte | 6 ++++-- frontend/src/routes/+page.svelte | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/src/lib/components/projects-popup.svelte b/frontend/src/lib/components/projects-popup.svelte index dc65193..015a113 100644 --- a/frontend/src/lib/components/projects-popup.svelte +++ b/frontend/src/lib/components/projects-popup.svelte @@ -64,7 +64,9 @@ application_link = data.application_link; filteredTags = filterTag(tags, id); // Active set to true after the await to avoid conflict when clicking outside while the popup hasn't showed yet. - active = true; + setTimeout(() => { + active = true; + }, 10); } } @@ -73,7 +75,7 @@ }); function hidePopup(event) { - if (!active) { + if (!active && popupMain.style.visibility === "visible") { return; } diff --git a/frontend/src/routes/+page.svelte b/frontend/src/routes/+page.svelte index 4a082b5..afd4e83 100644 --- a/frontend/src/routes/+page.svelte +++ b/frontend/src/routes/+page.svelte @@ -51,7 +51,6 @@ let isBottom = scrollY + innerHeight >= footer.offsetTop; let isMoved = scrollY + innerHeight >= sidebar.offsetHeight; let littleScreen = innerHeight < sidebar.offsetHeight; - console.log(littleScreen); // Only having the sticky sidebar if the size of the screen is too 'little' // Testing if sidebar is outside of scrolling scope