From d3724890519193e2444db3ac4647e4f7a6369a30 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Tue, 14 Mar 2023 22:18:29 +0100 Subject: [PATCH] docs: keyboard only search navigation --- docs/api/ApiIndex.vue | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/api/ApiIndex.vue b/docs/api/ApiIndex.vue index 048f20fd391..0d421775dcf 100644 --- a/docs/api/ApiIndex.vue +++ b/docs/api/ApiIndex.vue @@ -53,6 +53,14 @@ function apiSearchFocusHandler(event: KeyboardEvent): void { } else { apiFilter.value!.blur(); } + } else if (event.key === 'Enter') { + if (apiFilter.value !== document.activeElement) return; + if (query.value === '') return; + const item = filtered.value[0].items[0]; + if (!item) return; + const header = item.headers[0]; + if (!header) return; + window.location.href = item.link + '.html#' + slugify(header.anchor); } else if ( /^[a-z]$/.test(event.key) && !event.altKey &&