diff --git a/samples/MobileSandbox/MainView.xaml b/samples/MobileSandbox/MainView.xaml
index 5d35ec3fec..ccdfb090d2 100644
--- a/samples/MobileSandbox/MainView.xaml
+++ b/samples/MobileSandbox/MainView.xaml
@@ -8,7 +8,7 @@
-
+
diff --git a/src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs b/src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs
index a6e8d10777..374536e36c 100644
--- a/src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs
+++ b/src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs
@@ -624,6 +624,12 @@ namespace Avalonia.Android.Platform.SkiaPlatform
_inputMethod.IMM.HideSoftInputFromWindow(_inputMethod.View.WindowToken, HideSoftInputFlags.ImplicitOnly);
break;
}
+ case ImeAction.Next:
+ {
+ FocusManager.GetFocusManager(_toplevel.InputRoot)?
+ .TryMoveFocus(NavigationDirection.Next);
+ break;
+ }
}
return base.PerformEditorAction(actionCode);
diff --git a/src/Avalonia.Base/Input/FocusManager.cs b/src/Avalonia.Base/Input/FocusManager.cs
index c3316eb278..e110fc0827 100644
--- a/src/Avalonia.Base/Input/FocusManager.cs
+++ b/src/Avalonia.Base/Input/FocusManager.cs
@@ -200,6 +200,17 @@ namespace Avalonia.Input
// In our unit tests some elements might not have a root. Remove when we migrate to headless tests.
?? (FocusManager?)AvaloniaLocator.Current.GetService();
}
+
+ internal bool TryMoveFocus(NavigationDirection direction)
+ {
+ if (GetFocusedElement() is {} focusedElement
+ && KeyboardNavigationHandler.GetNext(focusedElement, direction) is {} newElement)
+ {
+ return newElement.Focus();
+ }
+
+ return false;
+ }
///
/// Checks if the specified element can be focused.
diff --git a/src/iOS/Avalonia.iOS/TextInputResponder.cs b/src/iOS/Avalonia.iOS/TextInputResponder.cs
index 935cf227da..05a3c208c3 100644
--- a/src/iOS/Avalonia.iOS/TextInputResponder.cs
+++ b/src/iOS/Avalonia.iOS/TextInputResponder.cs
@@ -182,6 +182,10 @@ partial class AvaloniaView
switch (ReturnKeyType)
{
+ case UIReturnKeyType.Next:
+ FocusManager.GetFocusManager(_view._topLevel)?
+ .TryMoveFocus(NavigationDirection.Next);
+ break;
case UIReturnKeyType.Done:
case UIReturnKeyType.Go:
case UIReturnKeyType.Send: