js: Fix incorrectly converted blur, click, focus method calls.

Commit a9ca5f603b (#15863) incorrectly
converted these.  e.target is a DOM element, not a jQuery element;
likewise for the elem parameter of activate_element.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2020-07-21 19:21:43 -07:00
parent 2d8cab2cee
commit a8bef38151
4 changed files with 7 additions and 7 deletions

View File

@ -757,24 +757,24 @@ exports.initialize = function () {
// disable the draggability for left-sidebar components
$("#stream_filters, #global_filters").on("dragstart", (e) => {
e.target.trigger("blur");
e.target.blur();
return false;
});
// Chrome focuses an element when dragging it which can be confusing when
// users involuntarily drag something and we show them the focus outline.
$("body").on("dragstart", "a", (e) => e.target.trigger("blur"));
$("body").on("dragstart", "a", (e) => e.target.blur());
// Don't focus links on middle click.
$("body").on("mouseup", "a", (e) => {
if (e.which === 2) {
// middle click
e.target.trigger("blur");
e.target.blur();
}
});
// Don't focus links on context menu.
$("body").on("contextmenu", "a", (e) => e.target.trigger("blur"));
$("body").on("contextmenu", "a", (e) => e.target.blur());
(function () {
const map = {

View File

@ -378,7 +378,7 @@ exports.launch = function () {
function activate_element(elem) {
$(".draft-info-box").removeClass("active");
$(elem).expectOne().addClass("active");
elem.trigger("focus");
elem.focus();
}
function drafts_initialize_focus(event_name) {

View File

@ -407,7 +407,7 @@ exports.navigate = function (event_name, e) {
if (event_name === "enter") {
if (is_composition(e.target)) {
e.target.trigger("click");
e.target.click();
} else {
toggle_selected_emoji(e);
}

View File

@ -272,7 +272,7 @@ exports.process_enter_key = function (e) {
// on #gear-menu li a[tabindex] elements, force a click and prevent default.
// this is because these links do not have an href and so don't force a
// default action.
e.target.trigger("click");
e.target.click();
return true;
}