fix: prevent Enter from submitting during IME composition#33
fix: prevent Enter from submitting during IME composition#33UnsongK wants to merge 1 commit intolsdefine:mainfrom
Conversation
When using CJK input methods, pressing Enter to confirm character selection was incorrectly triggering form submission. This fix listens for compositionstart/compositionend events and blocks Enter keydown during active IME composition.
lsdefine
left a comment
There was a problem hiding this comment.
Thanks for the fix! Two changes needed:
-
Add OS guard: This IME issue only affects macOS — on Windows the browser correctly fires
keydownaftercompositionend, so Enter never accidentally submits during composition. Please wrap the entire block withif os.name != 'nt':so Windows users don't get an unnecessary hidden iframe (whichcomponents.html(height=0)can still render as a visible empty element). -
Compress the line count: Currently +32 lines for a non-core fix is too much — it shouldn't exceed the surrounding core logic in length. The JS and Python can be significantly condensed. Please tighten it up.
|
Thanks for the contribution! I've incorporated the IME fix into main with a few changes:
Closing this PR. Appreciate the effort! 🙏 |
Fix IME composition issue with Enter key.
When using CJK input methods(Chinese/Japanese/Korean), pressing Enter to confirm character selection was incorrectly triggering form submission.
This fix listens for compositionstart/compositionend events and blocks Enter keydown during active IME composition.