diff --git a/zephyr/static/js/hotkey.js b/zephyr/static/js/hotkey.js index 1badeec08d..aa3d0e72cd 100644 --- a/zephyr/static/js/hotkey.js +++ b/zephyr/static/js/hotkey.js @@ -2,6 +2,8 @@ var hotkeys = (function () { var exports = {}; +exports.in_scroll_caused_by_keypress = false; + var directional_hotkeys = { 40: rows.next_visible, // down arrow 106: rows.next_visible, // 'j' @@ -65,6 +67,7 @@ function process_hotkey(e) { if (directional_hotkeys.hasOwnProperty(code)) { next_message = directional_hotkeys[code](selected_message); if (next_message.length !== 0) { + exports.in_scroll_caused_by_keypress = true; select_message(next_message, {then_scroll: true}); } if ((next_message.length === 0) && (code === 40 || code === 106)) { diff --git a/zephyr/static/js/ui.js b/zephyr/static/js/ui.js index 706793223c..51d4990721 100644 --- a/zephyr/static/js/ui.js +++ b/zephyr/static/js/ui.js @@ -530,9 +530,9 @@ $(function () { }); function scroll_finished() { - show_floating_recipient_bar(); - exports.update_floating_recipient_bar(); keep_pointer_in_view(); + hotkeys.in_scroll_caused_by_keypress = false; + exports.update_floating_recipient_bar(); if ($('#home').hasClass('active')) { if (viewport.scrollTop() === 0 && have_scrolled_away_from_top) { @@ -553,7 +553,12 @@ $(function () { } $(window).scroll($.throttle(50, function (e) { - hide_floating_recipient_bar(); + if (!hotkeys.in_scroll_caused_by_keypress) { + // Only hide the recipient bar when mousewheel/trackpad scrolling, + // not when going through messages one by one with the arrow + // keys. + hide_floating_recipient_bar(); + } scroll_finish(); }));