web-library
web-library copied to clipboard
Scroll up to 5 elements past when item scrolled into view would appear at the bottom
FWIW, here's what we do in the client:
https://github.com/zotero/zotero/blob/db56f002a533224a761d6e409fab39f8d05e8dbe/chrome/content/zotero/xpcom/itemTreeView.js#L1948-L1966
When scrolling down, we try to scroll 5 rows past the target, since having the selected row all the way at the bottom isn't that nice.
When scrolling up, we only scroll to the specified row or, if it's a child item and we have room, its parent. I think I felt that viewing the row (or its parent) as the top row was fine and scrolling past it felt a little odd.
Originally posted by @dstillman in https://github.com/zotero/web-library/issues/172#issuecomment-461301351
I've actually changed this behavior since I posted that:
https://github.com/zotero/zotero/blob/3c6ab77e44a9a4fe4858643d07f8f147929126fd/chrome/content/zotero/xpcom/itemTreeView.js#L1933-L2003
The changes were to support zotero://select links that can highlight multiple items, which I'm not sure we'll ever need in web-library, so most of this may not be relevant. But for single items, the relevant change is that, when an item is out of view, we no longer differentiate between scrolling up or down now just try to put it (or, if possible, its parent) 5 rows from the top. (I'm open to having the behavior be different, but it didn't seem that important when I was reimplementing this.)