Skip to content

Commit 6f07df3

Browse files
committed
fix: scroll autocomplete into view
1 parent 8d4f992 commit 6f07df3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/components/search/SearchBox.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ function ValueSuggestPopup({
220220
{values.map((v, i) => (
221221
<TagItem
222222
key={v}
223+
ref={i === activeIndex ? (el) => el?.scrollIntoView({ block: "nearest" }) : undefined}
223224
role="option"
224225
aria-selected={i === activeIndex}
225226
data-active={i === activeIndex || undefined}
@@ -251,6 +252,7 @@ function SearchTagPopup({
251252
{tags.map((t, i) => (
252253
<TagItem
253254
key={t.tag}
255+
ref={i === activeIndex ? (el) => el?.scrollIntoView({ block: "nearest" }) : undefined}
254256
role="option"
255257
aria-selected={i === activeIndex}
256258
data-active={i === activeIndex || undefined}

0 commit comments

Comments
 (0)