diff --git a/src/video/uikit/SDL_uikitviewcontroller.m b/src/video/uikit/SDL_uikitviewcontroller.m index 862df1967e286..99b2ae42b6d63 100644 --- a/src/video/uikit/SDL_uikitviewcontroller.m +++ b/src/video/uikit/SDL_uikitviewcontroller.m @@ -578,6 +578,14 @@ - (void)keyboardDidHide:(NSNotification *)notification - (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) { NSUInteger compareLength = SDL_min(textField.text.length, committedText.length); NSUInteger matchLength; @@ -612,6 +620,9 @@ - (void)textFieldTextDidChange:(NSNotification *)notification } committedText = textField.text; } + + if (startTextInputMomentarily) + SDL_StopTextInput(window); } - (void)updateKeyboard @@ -657,7 +668,7 @@ - (void)setKeyboardHeight:(int)height - (BOOL)textField:(UITextField *)_textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { if (textField.markedTextRange == nil) { - if (textField.text.length < 16) { + if ([string length] == 0 && textField.text.length < 16) { [self resetTextState]; } }