We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 225b6d4 commit febae0cCopy full SHA for febae0c
1 file changed
app/components/ReadmeTocDropdown.vue
@@ -139,6 +139,23 @@ function handleKeydown(event: KeyboardEvent) {
139
break
140
}
141
142
+
143
+const itemScrollIntoView = (index: number) => {
144
+ const item = props.toc[index]
145
+ if (!item) return
146
+ const el = document.getElementById(`${listboxId}-${item.id}`)
147
+ if (el) {
148
+ el.scrollIntoView({ block: 'center'})
149
+ }
150
+}
151
152
+watch(isOpen, (open) => {
153
+ if (open && highlightedIndex.value >= 0) {
154
+ itemScrollIntoView(highlightedIndex.value)
155
156
+}, {
157
+ flush: 'post',
158
+})
159
</script>
160
161
<template>
0 commit comments