mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	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:
		@@ -895,15 +895,24 @@ function get_page_up_down_delta() {
 | 
				
			|||||||
function page_up_navigation() {
 | 
					function page_up_navigation() {
 | 
				
			||||||
    const $scroll_container = ui.get_scroll_element($("#recent_topics_table .table_fix_head"));
 | 
					    const $scroll_container = ui.get_scroll_element($("#recent_topics_table .table_fix_head"));
 | 
				
			||||||
    const delta = get_page_up_down_delta();
 | 
					    const delta = get_page_up_down_delta();
 | 
				
			||||||
 | 
					    const new_scrollTop = $scroll_container.scrollTop() - delta;
 | 
				
			||||||
    $scroll_container.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() {
 | 
					function page_down_navigation() {
 | 
				
			||||||
    const $scroll_container = ui.get_scroll_element($("#recent_topics_table .table_fix_head"));
 | 
					    const $scroll_container = ui.get_scroll_element($("#recent_topics_table .table_fix_head"));
 | 
				
			||||||
    const delta = get_page_up_down_delta();
 | 
					    const delta = get_page_up_down_delta();
 | 
				
			||||||
 | 
					    const new_scrollTop = $scroll_container.scrollTop() + delta;
 | 
				
			||||||
    $scroll_container.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) {
 | 
					function check_row_type_transition(row, col) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user