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 d87e85c commit f2045e6Copy full SHA for f2045e6
app/components/ReadmeTocDropdown.vue
@@ -139,6 +139,27 @@ 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(
153
+ isOpen,
154
+ open => {
155
+ if (open && highlightedIndex.value >= 0) {
156
+ itemScrollIntoView(highlightedIndex.value)
157
158
+ },
159
+ {
160
+ flush: 'post',
161
162
+)
163
</script>
164
165
<template>
0 commit comments