forked from MarseyWorld/MarseyWorld
dont focus search bars on mobile since it triggers the keyboard which can be annoying
parent
7c01b13adf
commit
952fe68ea6
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue