Do not aggressively focus input when clicking anywhere
This commit is contained in:
parent
9164f65693
commit
7267f89377
@ -223,16 +223,6 @@ $(function() {
|
|||||||
input.trigger("focus");
|
input.trigger("focus");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$(window).on("focus", focus);
|
|
||||||
|
|
||||||
chat.on("click", ".chat", function() {
|
|
||||||
setTimeout(function() {
|
|
||||||
if (window.getSelection().isCollapsed) {
|
|
||||||
focus();
|
|
||||||
}
|
|
||||||
}, 2);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (navigator.platform.match(/(Mac|iPhone|iPod|iPad)/i)) {
|
if (navigator.platform.match(/(Mac|iPhone|iPod|iPad)/i)) {
|
||||||
@ -241,7 +231,7 @@ $(function() {
|
|||||||
|
|
||||||
$("#form").on("submit", function(e) {
|
$("#form").on("submit", function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
utils.forceFocus();
|
focus();
|
||||||
const target = chat.data("id");
|
const target = chat.data("id");
|
||||||
const text = input.val();
|
const text = input.val();
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
const $ = require("jquery");
|
const $ = require("jquery");
|
||||||
const escape = require("css.escape");
|
const escape = require("css.escape");
|
||||||
const input = $("#input");
|
|
||||||
const viewport = $("#viewport");
|
const viewport = $("#viewport");
|
||||||
|
|
||||||
var serverHash = -1; // eslint-disable-line no-var
|
var serverHash = -1; // eslint-disable-line no-var
|
||||||
@ -14,7 +13,6 @@ module.exports = {
|
|||||||
serverHash,
|
serverHash,
|
||||||
lastMessageId,
|
lastMessageId,
|
||||||
confirmExit,
|
confirmExit,
|
||||||
forceFocus,
|
|
||||||
scrollIntoViewNicely,
|
scrollIntoViewNicely,
|
||||||
hasRoleInChannel,
|
hasRoleInChannel,
|
||||||
move,
|
move,
|
||||||
@ -54,12 +52,6 @@ function hasRoleInChannel(channel, roles) {
|
|||||||
return user.parent().is("." + roles.join(", ."));
|
return user.parent().is("." + roles.join(", ."));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Triggering click event opens the virtual keyboard on mobile
|
|
||||||
// This can only be called from another interactive event (e.g. button click)
|
|
||||||
function forceFocus() {
|
|
||||||
input.trigger("click").trigger("focus");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reusable scrollIntoView parameters for channel list / user list
|
// Reusable scrollIntoView parameters for channel list / user list
|
||||||
function scrollIntoViewNicely(el) {
|
function scrollIntoViewNicely(el) {
|
||||||
// Ideally this would use behavior: "smooth", but that does not consistently work in e.g. Chrome
|
// Ideally this would use behavior: "smooth", but that does not consistently work in e.g. Chrome
|
||||||
|
Loading…
Reference in New Issue
Block a user