1
0
Fork 0
forked from Mirrors/gomuks

web/autocomplete: scroll selected item into view

This commit is contained in:
Tulir Asokan 2024-10-20 22:26:52 +03:00
parent 8ddf5f800d
commit 716f8b9834

View file

@ -52,6 +52,7 @@ export const EmojiAutocompleter = ({ params, state, setState, setAutocomplete }:
endPos: params.startPos + emoji.u.length,
frozenQuery: params.frozenQuery ?? params.query,
})
document.querySelector(`div.autocompletion-item[data-index='${index}']`)?.scrollIntoView({ block: "nearest" })
})
const onClick = useEvent((evt: React.MouseEvent<HTMLDivElement>) => {
const idx = evt.currentTarget.getAttribute("data-index")