You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PySDL2 example: pressing Enter inserts newlines instead of submitting the form #703
When running examples/pysdl2.py, pressing Enter in Google’s search input inserts a newline instead of submitting the search. Repeated Enter presses keep expanding the input field, as shown in the attached screenshot.
Proabable cause: the example’s handle_key_event() sends KEYEVENT_CHAR for Enter but does not send KEYEVENT_RAWKEYDOWN. This may prevent web pages from handling Enter as a key press.
It sends KEYEVENT_RAWKEYDOWN before the existing KEYEVENT_CHAR, allowing Google’s Enter handler to submit the search and prevent a newline.
I tested the unmodified v66.1 example against Google on Windows. With CEF 66, Google serves a single-line <input> and Enter submits. The same example with CEF 147 receives a <textarea> and inserts a newline. Adding the missing keydown restores search submission with CEF 147.
If this looks good to you, I'll cherry-pick this single commit into the PR branch.
Thanks, this fixes the missing keydown for Enter. I noticed that printable keys from SDL_TEXTINPUT are sent as KEYEVENT_CHAR, but their corresponding SDL_KEYDOWN events are ignored. Could you also send KEYEVENT_RAWKEYDOWN for printable key presses, while keeping SDL_TEXTINPUT responsible for KEYEVENT_CHAR? This would let pages receive normal keydown events for letters as well.
Activity
linesight commentedon Oct 25, 2026
Could you review this isolated fix for Enter in the PySDL2 example? Commit c490d1e
Branch diff
It sends
KEYEVENT_RAWKEYDOWNbefore the existingKEYEVENT_CHAR, allowing Google’s Enter handler to submit the search and prevent a newline.I tested the unmodified v66.1 example against Google on Windows. With CEF 66, Google serves a single-line
<input>and Enter submits. The same example with CEF 147 receives a<textarea>and inserts a newline. Adding the missing keydown restores search submission with CEF 147.If this looks good to you, I'll cherry-pick this single commit into the PR branch.
cztomczak commentedon Oct 25, 2026
Thanks, this fixes the missing keydown for Enter. I noticed that printable keys from
SDL_TEXTINPUTare sent asKEYEVENT_CHAR, but their correspondingSDL_KEYDOWNevents are ignored. Could you also sendKEYEVENT_RAWKEYDOWNfor printable key presses, while keepingSDL_TEXTINPUTresponsible forKEYEVENT_CHAR? This would let pages receive normalkeydownevents for letters as well.