mirror of https://github.com/zulip/zulip.git
Make tabbing to Save and Cancel in the message edit form work in Safari/desktop apps.
(imported from commit 74b7e2eedb541c1ed409390c0d61b05c106bebcc)
This commit is contained in:
parent
ec9c596933
commit
5a56e7cd29
|
@ -62,6 +62,8 @@ function get_event_name(e) {
|
|||
switch (e.which) {
|
||||
case 8:
|
||||
return 'backspace';
|
||||
case 9:
|
||||
return 'tab';
|
||||
case 13:
|
||||
return 'enter';
|
||||
case 27:
|
||||
|
@ -139,6 +141,18 @@ function process_hotkey(e) {
|
|||
}
|
||||
}
|
||||
|
||||
// In Safari and the desktop app, we can't tab to buttons. Intercept the
|
||||
// tab from the message edit content box to Save and then Cancel.
|
||||
if (event_name === "tab") {
|
||||
if ($("#message_edit_content").is(":focus")) {
|
||||
$(".message_edit_save").focus();
|
||||
return true;
|
||||
} else if ($(".message_edit_save").is(":focus")) {
|
||||
$(".message_edit_cancel").focus();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Process hotkeys specially when in an input, textarea, or send button
|
||||
if ($('input:focus,textarea:focus,#compose-send-button:focus').length > 0) {
|
||||
if (event_name === 'escape') {
|
||||
|
|
Loading…
Reference in New Issue