Skip to content

Keep the iOS keyboard up when focus moves between text boxes - #22529

Merged
MrJul merged 1 commit into
AvaloniaUI:mainfrom
NicholasLachapelle:fix/ios-keyboard-reset-noop-main
Oct 20, 2026
Merged

MrJul merged 1 commit into
AvaloniaUI:mainfrom
NicholasLachapelle:fix/ios-keyboard-reset-noop-main

Conversation

@NicholasLachapelle

Copy link
Copy Markdown
Contributor

What does the pull request do?

As agreed with @Gillibald, who confirmed that resetting the responder isn't required on iOS, this PR makes ITextInputMethodImpl.Reset() a no-op on iOS, as it already is on Android, so the keyboard stays up when focus moves from one text box to another.

What is the current behavior?

When focus moves between two text boxes, the keyboard slides down and comes back up. TextInputMethodManager calls Reset() before SetClient(), and the iOS Reset() makes AvaloniaView the first responder. AvaloniaView is not a text input, so UIKit dismisses the keyboard, then presents it again when SetClient() makes the next text box's responder first responder.

What is the updated/expected behavior with this PR?

The keyboard stays up while focus moves between text boxes. Moving focus to a control that is not a text input still dismisses it, because SetClient(null) still makes AvaloniaView first responder. InputPane no longer reports Closed then Open when focus moves between text boxes.

To test: in ControlCatalog on iOS, open the TextBox page, focus one text box, then tap another.

How was the solution implemented (if it's not obvious)?

Reset() is always followed by SetClient(), which makes the next text box's responder first responder directly, and UIKit resigns the previous one without hiding the keyboard. Handing first responder to the view in between is not needed.

Checklist

Breaking changes

None.

Fixed issues

Reset() made the AvaloniaView first responder before SetClient handed it to the next text box. AvaloniaView is not a text input, so UIKit dismissed the keyboard and presented it again on every focus change between text boxes.

Reset() is now a no-op, as on Android. The input method manager always calls SetClient right after it, which makes the next text box's responder first responder directly. When focus leaves text input, SetClient(null) still dismisses the keyboard.
@github-actions

Copy link
Copy Markdown

NuGet packages

The packages for this pull request have been published (workflow run):

@maxkatz6 maxkatz6 added bug os-ios backported-12.1.x backport-candidate-12.1.x Consider this PR for backporting to 12.1 branch and removed backported-12.1.x labels Oct 19, 2026
@MrJul
MrJul added this pull request to the merge queue Oct 20, 2026
Merged via the queue into AvaloniaUI:main with commit ba4fedb Oct 20, 2026
13 checks passed
MrJul pushed a commit that referenced this pull request Nov 2, 2026
Reset() made the AvaloniaView first responder before SetClient handed it to the next text box. AvaloniaView is not a text input, so UIKit dismissed the keyboard and presented it again on every focus change between text boxes.

Reset() is now a no-op, as on Android. The input method manager always calls SetClient right after it, which makes the next text box's responder first responder directly. When focus leaves text input, SetClient(null) still dismisses the keyboard.
@MrJul MrJul added backported-12.1.x and removed backport-candidate-12.1.x Consider this PR for backporting to 12.1 branch labels Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants