Skip to content

Commit 1433065

Browse files
committed
fix scroll in input suggestions
1 parent 8123fad commit 1433065

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

app/components/Input.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export default function Input({ value, onValueChange, handleSubmit, graph, icon,
9898
setSelectedOption(prev => {
9999
const newIndex = prev <= 0 ? options.length - 1 : prev - 1
100100
if (container) {
101-
container.children[newIndex].scrollIntoView({ behavior: 'smooth', block: 'nearest' })
101+
container.scrollTo({ behavior: 'smooth', top: 64 * newIndex })
102102
}
103103
return newIndex
104104
})
@@ -109,7 +109,7 @@ export default function Input({ value, onValueChange, handleSubmit, graph, icon,
109109
setSelectedOption(prev => {
110110
const newIndex = (prev + 1) % options.length
111111
if (container) {
112-
container.children[newIndex].scrollIntoView({ behavior: 'smooth', block: 'nearest' })
112+
container.scrollTo({ behavior: 'smooth', top: Math.min(64 * newIndex, container.scrollHeight) })
113113
}
114114
return newIndex
115115
})
@@ -171,13 +171,13 @@ export default function Input({ value, onValueChange, handleSubmit, graph, icon,
171171
const name = option.properties.name
172172
const path = option.properties.path
173173
let category = graph.CategoriesMap.get(label)
174-
174+
175175
if (!category) {
176176
category = { name: label, index: graph.CategoriesMap.size, show: true }
177177
graph.CategoriesMap.set(label, category)
178178
graph.Categories.push(category)
179179
}
180-
180+
181181
const colorName = getCategoryColorName(category.index)
182182
const color = getCategoryColorValue(category.index)
183183
return (

0 commit comments

Comments
 (0)