UX: Hotkey K can select partial posts

When no post is selected, K selects first partial post and J selects
first full post.
This commit is contained in:
Dan Ungureanu 2020-03-23 14:00:51 +02:00
parent 5db41cd578
commit 5715f0ad01
No known key found for this signature in database
GPG Key ID: 0AA2A00D6ACC8B84
1 changed files with 5 additions and 1 deletions

View File

@ -455,7 +455,11 @@ export default {
const offset = minimumOffset(); const offset = minimumOffset();
$selected = $articles $selected = $articles
.toArray() .toArray()
.find(article => article.getBoundingClientRect().top > offset); .find(article =>
direction > 0
? article.getBoundingClientRect().top > offset
: article.getBoundingClientRect().bottom > offset
);
if (!$selected) { if (!$selected) {
$selected = $articles[$articles.length - 1]; $selected = $articles[$articles.length - 1];
} }