Center scroll lists when navigating with keyboard

- This applies to channel list and user list sidebars
- This avoids having a selected item behind a sticky header
- This provides better UX by starting the scroll before the bottom (or top) is reached, giving a preview of what comes next (or before)
This commit is contained in:
Jérémie Astori 2018-07-24 00:50:19 -04:00
parent b8db7a2f82
commit 77d70d6d91
No known key found for this signature in database
GPG key ID: B9A4F245CD67BDE8

View file

@ -60,7 +60,7 @@ function hasRoleInChannel(channel, roles, nick) {
function scrollIntoViewNicely(el) {
// Ideally this would use behavior: "smooth", but that does not consistently work in e.g. Chrome
// https://github.com/iamdustan/smoothscroll/issues/28#issuecomment-364061459
el.scrollIntoView({block: "nearest", inline: "nearest"});
el.scrollIntoView({block: "center", inline: "nearest"});
}
function collapse() {