Select2 eats the Page Up and Page Down key events to prevent the page from scrolling, but I want the active list to scroll when these keys are pressed.
The challenge is scrolling the list by the correct number of indices, or pixels, if possible. Naively, I am calling this.moveHighlight(-5);
on KEY.PAGE_UP
and similar for KEY.PAGE_DOWN
.
What is the correct way to scroll the Select2 dropdown by exactly one page?
Here is the code that swallows the events:
if (e.which === KEY.PAGE_UP || e.which === KEY.PAGE_DOWN) {
// prevent the page from scrolling
killEvent(e);
return;
}