jkomoros / card-web

The web app behind thecompendium.cards
Apache License 2.0
46 stars 8 forks source link

Clicking a card in the strip centers it unexpectedly #582

Open jkomoros opened 2 years ago

jkomoros commented 2 years ago

This behavior might have been there for a long time and I haven't noticed it?

If you are on a list of cards, and scroll down a bit (so you're not at the top) and then click on a card, after a second or two, that card will be centered in the vertical height of the drawer.

That makes sense, but only if you didn't select a card by clicking, if you did, it kind of jumps around beneath your cursor (especially because it happens a few seconds after you clicked, oddly).

Trying to find a bisect for this, I got back as far as 6b4699ac02c0d74d672bae06fec2af7d0268078c and it was still happening (going back earlier doesn't work because there's incompatible data model things)

jkomoros commented 2 years ago

_scrollHighlightedThumbnailIntoView is called twice (as expected). The first time, it is called with _highlightedViaClick=true, but at the end of the handler is lowers that flag, so it means the second time, it will center... even though we're still being driven off something that was powered via click.