Fix iOS text input not working with password integration 2

This commit is contained in:
Salman Alshamrani
2025-11-30 11:13:55 -05:00
committed by Sam Lantinga
parent defd7895da
commit 7af479bc53

View File

@@ -578,6 +578,14 @@ static void SDLCALL SDL_HideHomeIndicatorHintChanged(void *userdata, const char
- (void)textFieldTextDidChange:(NSNotification *)notification
{
// When opening a password manager overlay to select a password and have it auto-filled,
// text input becomes stopped as a result of the keyboard being hidden or the text field losing focus.
// As a workaround, ensure text input is activated on any changes to the text field.
bool startTextInputMomentarily = !SDL_TextInputActive(window);
if (startTextInputMomentarily)
SDL_StartTextInput(window);
if (textField.markedTextRange == nil) {
if (isOTPMode && labs((NSInteger)textField.text.length - (NSInteger)committedText.length) != 1) {
return;
@@ -616,6 +624,9 @@ static void SDLCALL SDL_HideHomeIndicatorHintChanged(void *userdata, const char
}
committedText = textField.text;
}
if (startTextInputMomentarily)
SDL_StopTextInput(window);
}
- (void)updateKeyboard
@@ -661,7 +672,7 @@ static void SDLCALL SDL_HideHomeIndicatorHintChanged(void *userdata, const char
- (BOOL)textField:(UITextField *)_textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
if (!isOTPMode) {
if (textField.markedTextRange == nil && textField.text.length < 16) {
if (textField.markedTextRange == nil && [string length] == 0 && textField.text.length < 16) {
[self resetTextState];
}
}