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,16 +185,28 @@ function handle_keydown(e) {
|
||||||
const on_pm = target_sel === "#private_message_recipient";
|
const on_pm = target_sel === "#private_message_recipient";
|
||||||
const on_compose = target_sel === "#compose-textarea";
|
const on_compose = target_sel === "#compose-textarea";
|
||||||
|
|
||||||
if (on_compose && code === 13) {
|
if (on_compose) {
|
||||||
if (exports.should_enter_send(e)) {
|
if (code === 9) {
|
||||||
e.preventDefault();
|
// This if branch is only here to make Tab+Enter work on Safari,
|
||||||
if (!$("#compose-send-button").prop("disabled")) {
|
// which does not make <button>s tab-accessible by default
|
||||||
$("#compose-send-button").prop("disabled", true);
|
// (even if we were to set tabindex=0).
|
||||||
compose.finish();
|
if (!exports.should_enter_send(e)) {
|
||||||
|
$("#compose-send-button").trigger("focus");
|
||||||
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
return;
|
} else {
|
||||||
|
// Enter
|
||||||
|
if (exports.should_enter_send(e)) {
|
||||||
|
e.preventDefault();
|
||||||
|
if (!$("#compose-send-button").prop("disabled")) {
|
||||||
|
$("#compose-send-button").prop("disabled", true);
|
||||||
|
compose.finish();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.handle_enter($("#compose-textarea"), e);
|
||||||
}
|
}
|
||||||
exports.handle_enter($("#compose-textarea"), e);
|
|
||||||
} else if (on_stream || on_topic || on_pm) {
|
} else if (on_stream || on_topic || on_pm) {
|
||||||
// Prevent the form from submitting
|
// Prevent the form from submitting
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
Loading…
Reference in New Issue