missive / emoji-mart

🏪 One component to pick them all
https://missiveapp.com/open/emoji-mart
MIT License
8.59k stars 827 forks source link

Selected category does not always match scroll position #246

Closed tg2dex closed 3 years ago

nolanlawson commented 5 years ago

Yep, looks like a bug to me

nolanlawson commented 5 years ago

I cannot reproduce this using the storybook. Which browser was this in? Which scrolling method were you using? Is there a certain set of emoji-mart parameters that causes this?

nolanlawson commented 5 years ago

OK I managed to reproduce, but it's really unpredictable. What seems to be happening is that the top value calculated here can be wrong sometimes (it's too large, then it scrolls way too far down):

https://github.com/missive/emoji-mart/blob/7e207ba851fcf1bfb6e928cd61fb627d249eb047/src/components/category.js#L67-L72

nolanlawson commented 5 years ago

It looks like instead we could use scrollIntoView, and that should be quite a bit more predictable.