···137137 if (container && !container.contains(target)) clearDesktop();
138138 });
139139140140+ // desktop: keep the input focused when a result is clicked.
141141+ // Safari does not move focus to links/buttons on click, so mousedown would
142142+ // blur the input, fire focusout with a null relatedTarget, and clear the
143143+ // results before the click lands. Preventing the mousedown default keeps
144144+ // focus on the input while the click still navigates via the href.
145145+ document.addEventListener("mousedown", (e) => {
146146+ if ($("topbar-search-results")?.contains(e.target)) e.preventDefault();
147147+ });
148148+140149 // desktop: defer so a click on a result fires before results are cleared
141150 document.addEventListener("focusout", ({ target, relatedTarget }) => {
142151 const container = $("topbar-search-container");