mirror of
https://github.com/tulir/gomuks.git
synced 2025-04-20 10:33:41 -05:00
web/autocomplete: scroll selected item into view
This commit is contained in:
parent
8ddf5f800d
commit
716f8b9834
1 changed files with 1 additions and 0 deletions
|
@ -52,6 +52,7 @@ export const EmojiAutocompleter = ({ params, state, setState, setAutocomplete }:
|
||||||
endPos: params.startPos + emoji.u.length,
|
endPos: params.startPos + emoji.u.length,
|
||||||
frozenQuery: params.frozenQuery ?? params.query,
|
frozenQuery: params.frozenQuery ?? params.query,
|
||||||
})
|
})
|
||||||
|
document.querySelector(`div.autocompletion-item[data-index='${index}']`)?.scrollIntoView({ block: "nearest" })
|
||||||
})
|
})
|
||||||
const onClick = useEvent((evt: React.MouseEvent<HTMLDivElement>) => {
|
const onClick = useEvent((evt: React.MouseEvent<HTMLDivElement>) => {
|
||||||
const idx = evt.currentTarget.getAttribute("data-index")
|
const idx = evt.currentTarget.getAttribute("data-index")
|
||||||
|
|
Loading…
Add table
Reference in a new issue