From db9fb58bcaa15aaaa7a2fe9321a0a581132245b9 Mon Sep 17 00:00:00 2001 From: Kamil Sijko Date: Tue, 5 May 2026 11:50:28 +0200 Subject: [PATCH 01/30] =?UTF-8?q?=F0=9F=90=9B=20fix:=20race=20condition=20?= =?UTF-8?q?in=20search=20query=20execution?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a user opens the search modal and starts typing immediately, executeQuery() is triggered. Since buildIndex() is asynchronous, the fuse variable might still be undefined when .search() is called. Added safety checks for fuse initialization. --- assets/js/search.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/assets/js/search.js b/assets/js/search.js index e71e8c31..18a65e65 100644 --- a/assets/js/search.js +++ b/assets/js/search.js @@ -151,6 +151,12 @@ function buildIndex() { } function executeQuery(term) { + if (!indexed) { + buildIndex(); + } + if (!fuse) { + return; + } let results = fuse.search(term); let resultsHTML = ""; @@ -193,7 +199,7 @@ function executeQuery(term) { } output.innerHTML = resultsHTML; - if (results.length > 0) { + if (results.length > 0 && output.firstChild) { first = output.firstChild.firstElementChild; last = output.lastChild.firstElementChild; } From 1d6165181720a61a90ec202fec998fb7cd2ca7d3 Mon Sep 17 00:00:00 2001 From: ilantz <12483426+ilantz@users.noreply.github.com> Date: Fri, 15 May 2026 00:09:54 -0700 Subject: [PATCH 02/30] =?UTF-8?q?=E2=99=BF=EF=B8=8F=20Fix=20appearance=20s?= =?UTF-8?q?witcher=20accessibility=20tooltips?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dynamically update the appearance switcher accessibility labels and tooltips using the native i18n variables so that the UI correctly reflects the user's localized language instead of hardcoded English strings. --- assets/js/appearance.js | 23 +++++++++++++++++++ .../header/components/desktop-menu.html | 5 ++-- .../header/components/mobile-menu.html | 3 ++- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/assets/js/appearance.js b/assets/js/appearance.js index 1af7f713..da3f8a9b 100644 --- a/assets/js/appearance.js +++ b/assets/js/appearance.js @@ -54,12 +54,33 @@ window.addEventListener("DOMContentLoaded", (event) => { const switcher = document.getElementById("appearance-switcher"); const switcherMobile = document.getElementById("appearance-switcher-mobile"); + // Load the i18n translations for the tooltips + const darkLabel = '{{ i18n "footer.dark_appearance" }}'; + const lightLabel = '{{ i18n "footer.light_appearance" }}'; + updateMeta(); this.updateLogo?.(getTargetAppearance()); // Initialize mermaid theme on page load updateMermaidTheme(); + // Helper to update the tooltip depending on the current mode + const updateTooltip = (targetAppearance) => { + // If target is dark, the next action will be switching to light + const label = targetAppearance === "dark" ? lightLabel : darkLabel; + if (switcher) { + switcher.setAttribute("aria-label", label); + switcher.setAttribute("title", label); + } + if (switcherMobile) { + switcherMobile.setAttribute("aria-label", label); + switcherMobile.setAttribute("title", label); + } + }; + + // Set initial tooltip on load + updateTooltip(getTargetAppearance()); + if (switcher) { switcher.addEventListener("click", () => { document.documentElement.classList.toggle("dark"); @@ -70,6 +91,7 @@ window.addEventListener("DOMContentLoaded", (event) => { ); updateMeta(); updateMermaidTheme(); + updateTooltip(targetAppearance); this.updateLogo?.(targetAppearance); }); switcher.addEventListener("contextmenu", (event) => { @@ -87,6 +109,7 @@ window.addEventListener("DOMContentLoaded", (event) => { ); updateMeta(); updateMermaidTheme(); + updateTooltip(targetAppearance); this.updateLogo?.(targetAppearance); }); switcherMobile.addEventListener("contextmenu", (event) => { diff --git a/layouts/partials/header/components/desktop-menu.html b/layouts/partials/header/components/desktop-menu.html index 2ae3c0ef..492d8d13 100644 --- a/layouts/partials/header/components/desktop-menu.html +++ b/layouts/partials/header/components/desktop-menu.html @@ -24,9 +24,10 @@