diff options
| author | ST-DDT <[email protected]> | 2023-03-20 19:56:22 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-03-20 18:56:22 +0000 |
| commit | 93e1433b92c69331349e9feccdf57b84a82a2555 (patch) | |
| tree | dc42ac16c1939b6401fb62210d107e9385478790 /docs | |
| parent | 5dc2fa87c245c39980c875d679319ecf718282ac (diff) | |
| download | faker-93e1433b92c69331349e9feccdf57b84a82a2555.tar.xz faker-93e1433b92c69331349e9feccdf57b84a82a2555.zip | |
docs: keyboard only search navigation (#1932)
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/api/ApiIndex.vue | 8 |
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 && |
