diff --git a/appData/js-emulator/js/other/controls.js b/appData/js-emulator/js/other/controls.js index 2cc838ecf..477a8870a 100644 --- a/appData/js-emulator/js/other/controls.js +++ b/appData/js-emulator/js/other/controls.js @@ -227,6 +227,15 @@ if (isTouchEnabled) { bindKeyboard(); bindClick(); +function resetKeys() { + for (var key in defaultKeys) { + GameBoyKeyUp(key); + } +} + +window.addEventListener("focus", resetKeys); +window.addEventListener("blur", resetKeys); + // HTML Gamepad API Support // Load a key map for gamepad-to-gameboy buttons