Fix unfocusing tag input when switching characters

This commit is contained in:
Cohee
2024-03-16 23:35:41 +02:00
parent a789c6f76f
commit ad450981c0

View File

@@ -5351,9 +5351,12 @@ async function getChat() {
await getChatResult(); await getChatResult();
eventSource.emit('chatLoaded', { detail: { id: this_chid, character: characters[this_chid] } }); eventSource.emit('chatLoaded', { detail: { id: this_chid, character: characters[this_chid] } });
// Focus on the textarea if not already focused on a visible text input
setTimeout(function () { setTimeout(function () {
$('#send_textarea').click(); if ($(document.activeElement).is('input:visible, textarea:visible')) {
$('#send_textarea').focus(); return;
}
$('#send_textarea').trigger('click').trigger('focus');
}, 200); }, 200);
} catch (error) { } catch (error) {
await getChatResult(); await getChatResult();