HTML5Window: call blur() before removing the compositionend listener (references openfl/openfl#2564)

This ensures that incomplete IME input gets committed
This commit is contained in:
Josh Tynjala
2023-01-11 12:49:49 -08:00
parent 46d2145baa
commit 46012b9fdb

View File

@@ -1178,6 +1178,10 @@ class HTML5Window
{ {
if (textInput != null) if (textInput != null)
{ {
// call blur() before removing the compositionend listener
// to ensure that incomplete IME input is committed
textInput.blur();
textInput.removeEventListener('input', handleInputEvent, true); textInput.removeEventListener('input', handleInputEvent, true);
textInput.removeEventListener('blur', handleFocusEvent, true); textInput.removeEventListener('blur', handleFocusEvent, true);
textInput.removeEventListener('cut', handleCutOrCopyEvent, true); textInput.removeEventListener('cut', handleCutOrCopyEvent, true);
@@ -1186,7 +1190,6 @@ class HTML5Window
textInput.removeEventListener('compositionstart', handleCompositionstartEvent, true); textInput.removeEventListener('compositionstart', handleCompositionstartEvent, true);
textInput.removeEventListener('compositionend', handleCompositionendEvent, true); textInput.removeEventListener('compositionend', handleCompositionendEvent, true);
textInput.blur();
} }
} }