A bug could happen if the open entry had a bigger height than the viewport. In this case the code that detects the first visible entry failed (it assumes there is at least an entry link visible in the list) and the variable that holds the first visible entry was left undefined; when searching its index in the global entries list, this index took the value -1 (which means "the entry has not been found in the list").
This was not properly controlled, and the js controller marked as read all entries from the first (index 0) to the first visible (-1)... which actually caused all entries in the global entries list to be marked as read, both above and below the currently visible entry.
A quick for this is in this commit: after scrolling, when looking for the first visible entry, control the situation in which no entry is found in the viewport. In this case, skip the rest of the function (do not mark any entries as read).
This fixes the bug that caused entries below the current one to be marked as read; still the behavior is not as intended, because if the user scrolls to the middle of a very long entry, no entries are marked as read. The expected behavior is that entries above this one be marked read; this will be implemented in another commit. The fix will be to refine the code that finds the first visible entry in the viewport, so that if the entry link is not visible it still finds the entry based on its content being visible.
↧