From b727ac85bbfd1739e6ce3a4caa37e9d803f363b6 Mon Sep 17 00:00:00 2001 From: eti Date: Mon, 6 Jul 2026 12:17:22 +0200 Subject: [PATCH] appview/topbar-search: fix safari click on result items Signed-off-by: eti --- appview/pages/static/topbar-search.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/appview/pages/static/topbar-search.js b/appview/pages/static/topbar-search.js index a6f1e69d..04118189 100644 --- a/appview/pages/static/topbar-search.js +++ b/appview/pages/static/topbar-search.js @@ -137,6 +137,15 @@ if (container && !container.contains(target)) clearDesktop(); }); + // desktop: keep the input focused when a result is clicked. + // Safari does not move focus to links/buttons on click, so mousedown would + // blur the input, fire focusout with a null relatedTarget, and clear the + // results before the click lands. Preventing the mousedown default keeps + // focus on the input while the click still navigates via the href. + document.addEventListener("mousedown", (e) => { + if ($("topbar-search-results")?.contains(e.target)) e.preventDefault(); + }); + // desktop: defer so a click on a result fires before results are cleared document.addEventListener("focusout", ({ target, relatedTarget }) => { const container = $("topbar-search-container"); -- 2.51.2