diff --git a/evennia/web/webclient/static/webclient/js/plugins/default_in.js b/evennia/web/webclient/static/webclient/js/plugins/default_in.js index 56e6dc6c8a..cfde412043 100644 --- a/evennia/web/webclient/static/webclient/js/plugins/default_in.js +++ b/evennia/web/webclient/static/webclient/js/plugins/default_in.js @@ -34,8 +34,18 @@ let defaultin_plugin = (function () { } inputfield.val(""); // Clear this inputfield event.preventDefault(); - } - inputfield.blur(); + + // enter key by itself should toggle focus + if( inputfield.length < 1 ) { + inputfield = $(".inputfield:last"); + inputfield.focus(); + if( inputfield.length < 1 ) { // non-goldenlayout backwards compatibility + $("#inputfield").focus(); + } + } else { + inputfield.blur(); + } + } // else allow building a multi-line input command break; // Anything else, focus() a textarea if needed, and allow the default event diff --git a/evennia/web/webclient/static/webclient/js/plugins/history.js b/evennia/web/webclient/static/webclient/js/plugins/history.js index b6130a235d..2aa6f0991f 100644 --- a/evennia/web/webclient/static/webclient/js/plugins/history.js +++ b/evennia/web/webclient/static/webclient/js/plugins/history.js @@ -63,6 +63,9 @@ let history = (function () { // Doing a history navigation; replace the text in the input and // move the cursor to the end of the new value var inputfield = $(".inputfield:focus"); + if( inputfield.length < 1 ) { // focus the default (last), if nothing focused + inputfield = $(".inputfield:last"); + } if( inputfield.length < 1 ) { // pre-goldenlayout backwards compatibility inputfield = $("#inputfield"); }