FIX: Fallback to last post when the in-view post cannot be detected.

In certain situations the detection method fails. For example, it fails
for a topic containing: a long post (~1600px height), gap, small action
(focus on this), hidden reply.
This commit is contained in:
Dan Ungureanu 2019-04-11 01:14:22 +03:00
parent 87de5d9e8f
commit 7a7c6af21e
No known key found for this signature in database
GPG Key ID: 0AA2A00D6ACC8B84
1 changed files with 3 additions and 0 deletions

View File

@ -445,6 +445,9 @@ export default {
$selected = $articles $selected = $articles
.toArray() .toArray()
.find(article => article.getBoundingClientRect().top > offset); .find(article => article.getBoundingClientRect().top > offset);
if (!$selected) {
$selected = $articles[$articles.length - 1];
}
direction = 0; direction = 0;
} }