From 77d70d6d913583aa5b11a99942705f2bf2f552cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Astori?= Date: Tue, 24 Jul 2018 00:50:19 -0400 Subject: [PATCH] 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) --- client/js/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/js/utils.js b/client/js/utils.js index 41a5c8ec..5b185465 100644 --- a/client/js/utils.js +++ b/client/js/utils.js @@ -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() {