SDL: emscripten: don't consume key down/up events if the user disabled them

From b80f6ec05cb6ffab0bfb2660689922e4a9e99a03 Mon Sep 17 00:00:00 2001
From: Ahmed Essam <[EMAIL REDACTED]>
Date: Wed, 10 Jul 2024 15:26:44 +0300
Subject: [PATCH] emscripten: don't consume key down/up events if the user
 disabled them

---
 src/video/emscripten/SDL_emscriptenevents.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/video/emscripten/SDL_emscriptenevents.c b/src/video/emscripten/SDL_emscriptenevents.c
index 2017a6aee2b85..407bb41eaca2b 100644
--- a/src/video/emscripten/SDL_emscriptenevents.c
+++ b/src/video/emscripten/SDL_emscriptenevents.c
@@ -794,7 +794,7 @@ static EM_BOOL Emscripten_HandleKey(int eventType, const EmscriptenKeyboardEvent
 {
     const SDL_Keycode keycode = Emscripten_MapKeyCode(keyEvent);
     SDL_Scancode scancode = Emscripten_MapScanCode(keyEvent->code);
-    SDL_bool prevent_default = SDL_TRUE;
+    SDL_bool prevent_default = SDL_GetEventState(eventType == EMSCRIPTEN_EVENT_KEYDOWN ? SDL_KEYDOWN : SDL_KEYUP) == SDL_ENABLE;
     SDL_bool is_nav_key = SDL_FALSE;
 
     if (scancode == SDL_SCANCODE_UNKNOWN) {