mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 22:43:42 +00:00
Fix issue where arrowing-down near end of page would skip a message.
We had this fascinating behavior where pressing a down arrow near the end of the page would advance the pointer, call recenter_view, which would trigger a scroll event, which would call keep_pointer_in_view, which would notice that we were at the end of the page and advance the pointer again! I split out that last part into its own function which is only called on mousewheel events. (imported from commit bc85443e762356e3055f8f88585940a1f11f9124)
This commit is contained in:
@@ -138,9 +138,15 @@ $(function () {
|
||||
sub_from_home(compose_class_name(), $('#class-nosub'));
|
||||
});
|
||||
|
||||
var throttled_scrollhandler = $.throttle(50, function() {
|
||||
var throttled_scrollhandler = $.throttle(50, function(e) {
|
||||
if ($('#home').hasClass('active')) {
|
||||
keep_pointer_in_view();
|
||||
keep_pointer_in_view();
|
||||
if (e.type === 'mousewheel') {
|
||||
// If we mousewheel (or trackpad-scroll) when
|
||||
// we're at the top and bottom of the page, the
|
||||
// pointer may still want to move.
|
||||
move_pointer_at_page_top_and_bottom();
|
||||
}
|
||||
}
|
||||
});
|
||||
$(window).mousewheel(throttled_scrollhandler);
|
||||
|
||||
Reference in New Issue
Block a user