dont focus search bars on mobile since it triggers the keyboard which can be annoying

master
Aevann 2023-02-18 20:58:07 +02:00
parent 7c01b13adf
commit 952fe68ea6
3 changed files with 15 additions and 7 deletions

View File

@ -433,3 +433,11 @@ function logout(t) {
location.href = '/'
});
}
const width = (window.innerWidth > 0) ? window.innerWidth : screen.width;
function focusSearchBar(element)
{
if (width >= 768) {
element.focus();
}
}

View File

@ -266,7 +266,7 @@ function switchEmojiTab(e)
const className = e.currentTarget.dataset.className;
emojiSearchBarDOM.value = "";
emojiSearchBarDOM.focus();
focusSearchBar(emojiSearchBarDOM);
emojiNotFoundDOM.hidden = true;
// Special case: favorites
@ -567,11 +567,11 @@ function loadEmojis(inputTargetIDName)
}
document.getElementById('emojiModal').addEventListener('shown.bs.modal', function () {
emojiSearchBarDOM.focus();
focusSearchBar(emojiSearchBarDOM);
setTimeout(() => {
emojiSearchBarDOM.focus();
focusSearchBar(emojiSearchBarDOM);
}, 200);
setTimeout(() => {
emojiSearchBarDOM.focus();
focusSearchBar(emojiSearchBarDOM);
}, 1000);
});

View File

@ -15,12 +15,12 @@ function insertGIF(url) {
}
document.getElementById('gifModal').addEventListener('shown.bs.modal', function () {
gifSearchBar.focus();
focusSearchBar(gifSearchBar);
setTimeout(() => {
gifSearchBar.focus();
focusSearchBar(gifSearchBar);
}, 200);
setTimeout(() => {
gifSearchBar.focus();
focusSearchBar(gifSearchBar);
}, 1000);
});