Skip to content

Commit df4f624

Browse files
committed
DOC-131 keyboard nav highlight
1 parent 6fbd051 commit df4f624

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/_sass/components/_search.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,7 @@ a.aa-link:hover {
5959
.aa-empty{
6060
padding:15px 15px;
6161
}
62+
63+
.aa-cursor {
64+
background-color: #fafbff;
65+
}

src/assets/algolia.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const docs = client.initIndex('segment-docs');
33

44
autocomplete(
55
'#autocomplete', {
6+
hint: false,
67
debug: true,
78
keyboardShortcuts: ['s', 191],
89
templates: {
@@ -39,7 +40,13 @@ autocomplete(
3940
empty: '<div class="aa-empty">No matching results</div>',
4041
},
4142
}, ]
42-
);
43+
).on('autocomplete:selected', function (event, suggestion, dataset) {
44+
if (suggestion.anchor) {
45+
window.location.href = '/docs' + suggestion.url + '#' + suggestion.anchor;
46+
} else {
47+
window.location.href = '/docs' + suggestion.url;
48+
}
49+
});
4350

4451
window.addEventListener('/', (e) => {
4552
window.scrollTo(0, 0);

0 commit comments

Comments
 (0)