mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 17:36:27 +00:00
Fix auto-scrolling by not calling within_viewport.
The geometry used by within_viewport() is a little off to begin with, but we don't want to check it at all in this situation, because if the last messages falls out of the viewport, we still want to scroll. The relevant thing to check is that available_space_for_scroll exceeds zero. (imported from commit a0a6f0d23db2eab8d9f22fc9ad523031cf7f7ec2)
This commit is contained in:
committed by
Leo Franchi
parent
ecd3903007
commit
4ce6a6ea25
@@ -420,9 +420,7 @@ MessageList.prototype = {
|
||||
|
||||
var selected_row = current_msg_list.selected_row();
|
||||
var last_visible = rows.last_visible();
|
||||
if (within_viewport(last_visible.offset(), last_visible.height())
|
||||
&& selected_row && (selected_row.length > 0))
|
||||
{
|
||||
if (selected_row && (selected_row.length > 0)) {
|
||||
var viewport_offset = viewport.scrollTop();
|
||||
var new_messages_height = 0;
|
||||
|
||||
@@ -438,11 +436,13 @@ MessageList.prototype = {
|
||||
var available_space_for_scroll = selected_row_offset - viewport_offset -
|
||||
$("#floating_recipient_bar").height() - $("#searchbox_form").height();
|
||||
|
||||
suppress_scroll_pointer_update = true; // Gets set to false in the scroll handler.
|
||||
// viewport (which is window) doesn't have a scrollTop, so scroll
|
||||
// the closest concept that does.
|
||||
$("html, body").animate({scrollTop: viewport_offset +
|
||||
Math.min(new_messages_height, available_space_for_scroll)});
|
||||
if (available_space_for_scroll > 0) {
|
||||
suppress_scroll_pointer_update = true; // Gets set to false in the scroll handler.
|
||||
// viewport (which is window) doesn't have a scrollTop, so scroll
|
||||
// the closest concept that does.
|
||||
$("html, body").animate({scrollTop: viewport_offset +
|
||||
Math.min(new_messages_height, available_space_for_scroll)});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user