recent_topics: Set focus to first/last row on page up/down at ends.

This change is to match the behaviour of page up/down on messages.
So, If you hit PageUp/Down while there's no additional pace to scroll,
we move the selected topic to the first/last topic as appropriate.
This commit is contained in:
Aman Agrawal
2022-10-19 18:41:51 +00:00
committed by Tim Abbott
parent eb1c3bc293
commit f2f4bed85c

View File

@@ -895,15 +895,24 @@ function get_page_up_down_delta() {
function page_up_navigation() {
const $scroll_container = ui.get_scroll_element($("#recent_topics_table .table_fix_head"));
const delta = get_page_up_down_delta();
$scroll_container.scrollTop($scroll_container.scrollTop() - delta);
const new_scrollTop = $scroll_container.scrollTop() - delta;
if (new_scrollTop <= 0) {
row_focus = 0;
}
$scroll_container.scrollTop(new_scrollTop);
set_table_focus(row_focus, col_focus);
}
function page_down_navigation() {
const $scroll_container = ui.get_scroll_element($("#recent_topics_table .table_fix_head"));
const delta = get_page_up_down_delta();
$scroll_container.scrollTop($scroll_container.scrollTop() + delta);
const new_scrollTop = $scroll_container.scrollTop() + delta;
const table_height = $("#recent_topics_table .table_fix_head").height();
if (new_scrollTop >= table_height) {
row_focus = topics_widget.get_current_list().length - 1;
}
$scroll_container.scrollTop(new_scrollTop);
set_table_focus(row_focus, col_focus);
}
function check_row_type_transition(row, col) {