search key nav fixes 2
All checks were successful
Build Org Website / build (push) Successful in 44s

This commit is contained in:
gitea-actions
2026-05-14 14:20:07 +01:00
parent a45015fae8
commit 41d5f8820e
3 changed files with 16 additions and 7 deletions

View File

@@ -195,6 +195,11 @@ function isSearchOpen() {
return modal.classList.contains("is-open");
}
function focusPaneInput() {
paneInput.focus({ preventScroll: true });
paneInput.setSelectionRange(paneInput.value.length, paneInput.value.length);
}
function openSearchPane(initialValue = "") {
const value = initialValue || searchInput?.value || paneInput?.value || "";
@@ -206,10 +211,8 @@ function openSearchPane(initialValue = "") {
setHeaderSearchValue(value);
renderResults(value);
window.setTimeout(() => {
paneInput.focus();
paneInput.setSelectionRange(paneInput.value.length, paneInput.value.length);
}, 0);
focusPaneInput();
window.requestAnimationFrame(focusPaneInput);
}
function closeSearchPane() {