From fb729e5166f327d53816604cc23489acaf939a3e Mon Sep 17 00:00:00 2001 From: ed Date: Tue, 27 Jul 2021 12:13:00 +0200 Subject: [PATCH] file selection scroll behavior --- README.md | 1 + copyparty/web/browser.css | 4 ++++ copyparty/web/browser.js | 4 +++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1e30b921..7289da05 100644 --- a/README.md +++ b/README.md @@ -236,6 +236,7 @@ the browser has the following hotkeys (assumes qwerty, ignores actual layout) * `F2` rename selected file/folder * when a file/folder is selected (in not-grid-view): * `Up/Down` move cursor + * shift+`Up/Down` move cursor and scroll viewport * `Space` toggle file selection * `Ctrl-A` toggle select all * when playing audio: diff --git a/copyparty/web/browser.css b/copyparty/web/browser.css index 8292b125..e7c3c2ce 100644 --- a/copyparty/web/browser.css +++ b/copyparty/web/browser.css @@ -166,6 +166,10 @@ body { padding: .3em 0; scroll-margin-top: 45vh; } +#files tr { + scroll-margin-top: 25vh; + scroll-margin-bottom: 20vh; +} #files tbody div a { color: #f5a; } diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 5967d0fe..d7282b40 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -2031,7 +2031,9 @@ document.onkeydown = function (e) { var el = ae[d + 'ElementSibling']; if (el) { el.focus(); - document.documentElement.scrollTop += (d == 'next' ? 1 : -1) * el.offsetHeight; + if (e.shiftKey) + document.documentElement.scrollTop += (d == 'next' ? 1 : -1) * el.offsetHeight; + return ev(e); } }