mirror of https://github.com/zulip/zulip.git
Do a little handling of Home, End, PgUp, PgDn ourselves.
It turns out it's marginally easier for us to completely handle Home and End ourselves rather than let the browser do it, because home scrolls to the top of the page, but it does not select the topmost message. With PgUp and PgDn, the default browser behavior is fine, but it seems like PgUp on a screen where you're already "scrolled to the top" should not be a no-op. (imported from commit 609d639f3a4313e75e1fd6138966f15447b70f2e)
This commit is contained in:
parent
ff227d3384
commit
1f669e1c85
|
@ -32,7 +32,7 @@ function simulate_keypress(keycode) {
|
|||
}
|
||||
|
||||
function process_hotkey(code) {
|
||||
var next_zephyr, window_to_scroll;
|
||||
var next_zephyr;
|
||||
if (directional_hotkeys.hasOwnProperty(code)) {
|
||||
next_zephyr = directional_hotkeys[code](selected_zephyr);
|
||||
if (next_zephyr.length !== 0) {
|
||||
|
@ -49,11 +49,6 @@ function process_hotkey(code) {
|
|||
return process_hotkey;
|
||||
}
|
||||
|
||||
window_to_scroll = $(".active.scrolling_tab");
|
||||
if (window_to_scroll.length === 0) {
|
||||
window_to_scroll = $(".active").find(".scrolling-tab");
|
||||
}
|
||||
|
||||
if (num_pressed_keys() > 1) {
|
||||
// If you are already holding down another key, none of these
|
||||
// actions apply.
|
||||
|
@ -62,13 +57,11 @@ function process_hotkey(code) {
|
|||
|
||||
switch (code) {
|
||||
case 33: // Page Up
|
||||
window_to_scroll.scrollTop(window_to_scroll.scrollTop() - window_to_scroll.height());
|
||||
keep_pointer_in_view();
|
||||
return process_hotkey;
|
||||
return false; // We want the browser to actually page up and down
|
||||
case 34: // Page Down
|
||||
window_to_scroll.scrollTop(window_to_scroll.scrollTop() + window_to_scroll.height());
|
||||
keep_pointer_in_view();
|
||||
return process_hotkey;
|
||||
return false;
|
||||
case 27: // Esc: hide compose pane
|
||||
hide_compose();
|
||||
return process_hotkey;
|
||||
|
|
Loading…
Reference in New Issue