aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorST-DDT <[email protected]>2023-03-20 19:56:22 +0100
committerGitHub <[email protected]>2023-03-20 18:56:22 +0000
commit93e1433b92c69331349e9feccdf57b84a82a2555 (patch)
treedc42ac16c1939b6401fb62210d107e9385478790 /docs
parent5dc2fa87c245c39980c875d679319ecf718282ac (diff)
downloadfaker-93e1433b92c69331349e9feccdf57b84a82a2555.tar.xz
faker-93e1433b92c69331349e9feccdf57b84a82a2555.zip
docs: keyboard only search navigation (#1932)
Diffstat (limited to 'docs')
-rw-r--r--docs/api/ApiIndex.vue8
1 files changed, 8 insertions, 0 deletions
diff --git a/docs/api/ApiIndex.vue b/docs/api/ApiIndex.vue
index 048f20fd..0d421775 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 &&