mirror of https://github.com/zulip/zulip.git
compose: Restore Tab+Enter sending in Safari.
Safari doesn't make <button>s tab-accessible by default,
so this commit adds back the manual focus removed in
3b0694693b
.
This commit is contained in:
parent
c1ba648b4f
commit
2d30af113e
|
@ -185,7 +185,17 @@ function handle_keydown(e) {
|
|||
const on_pm = target_sel === "#private_message_recipient";
|
||||
const on_compose = target_sel === "#compose-textarea";
|
||||
|
||||
if (on_compose && code === 13) {
|
||||
if (on_compose) {
|
||||
if (code === 9) {
|
||||
// This if branch is only here to make Tab+Enter work on Safari,
|
||||
// which does not make <button>s tab-accessible by default
|
||||
// (even if we were to set tabindex=0).
|
||||
if (!exports.should_enter_send(e)) {
|
||||
$("#compose-send-button").trigger("focus");
|
||||
e.preventDefault();
|
||||
}
|
||||
} else {
|
||||
// Enter
|
||||
if (exports.should_enter_send(e)) {
|
||||
e.preventDefault();
|
||||
if (!$("#compose-send-button").prop("disabled")) {
|
||||
|
@ -194,7 +204,9 @@ function handle_keydown(e) {
|
|||
}
|
||||
return;
|
||||
}
|
||||
|
||||
exports.handle_enter($("#compose-textarea"), e);
|
||||
}
|
||||
} else if (on_stream || on_topic || on_pm) {
|
||||
// Prevent the form from submitting
|
||||
e.preventDefault();
|
||||
|
|
Loading…
Reference in New Issue