FIX: J/K navigation resets current selection when scrolling fast.

Sometimes, when keeping J or K pressed and scrolling fast, the current
selection would go out of the viewport for a few moments and the
algorithm would try selecting the "best" element that is in viewport.

This bug is reproducible only on certain machines. For example, Linux
machines seem to be passing key events faster to the browser.
This commit is contained in:
Dan Ungureanu 2019-08-16 17:28:25 +03:00
parent 936d4ce17a
commit df6630f868
No known key found for this signature in database
GPG Key ID: 0AA2A00D6ACC8B84
1 changed files with 1 additions and 1 deletions

View File

@ -441,7 +441,7 @@ export default {
// Discard selection if it is not in viewport, so users can combine
// keyboard shortcuts with mouse scrolling.
if ($selected.length !== 0) {
if ($selected.length !== 0 && !fast) {
const offset = minimumOffset();
const beginScreen = $(window).scrollTop() - offset;
const endScreen = beginScreen + window.innerHeight + offset;