Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -677,5 +677,22 @@ public async Task When_ReadOnly_Toggled_Repeatedly()

Assert.AreEqual(updatedText.Length, textBox.SelectionLength);
}

#if __ANDROID__
[TestMethod]
public async Task When_TextBox_ImeAction_Enter()
{
var textBox = new TextBox
{
Text = "Text",
};

WindowHelper.WindowContent = textBox;
await WindowHelper.WaitForLoaded(textBox);

var act = () => textBox.OnEditorAction(textBox.TextBoxView, Android.Views.InputMethods.ImeAction.Next, null);
act.Should().NotThrow();
}
#endif
}
}
6 changes: 3 additions & 3 deletions src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -555,9 +555,9 @@ public bool OnEditorAction(TextView v, [GeneratedEnum] ImeAction actionId, KeyEv
{
//We need to force a keypress event on editor action.
//the key press event is not triggered if we press the enter key depending on the ime.options

RaiseEvent(KeyUpEvent, new KeyRoutedEventArgs(this, global::Windows.System.VirtualKey.Enter, VirtualKeyHelper.FromModifiers(e.Modifiers)));
RaiseEvent(KeyUpEvent, new KeyRoutedEventArgs(this, global::Windows.System.VirtualKey.Enter, VirtualKeyHelper.FromModifiers(e.Modifiers)));
var modifiers = e is not null ? VirtualKeyHelper.FromModifiers(e.Modifiers) : VirtualKeyModifiers.None;
RaiseEvent(KeyUpEvent, new KeyRoutedEventArgs(this, global::Windows.System.VirtualKey.Enter, modifiers));
RaiseEvent(KeyUpEvent, new KeyRoutedEventArgs(this, global::Windows.System.VirtualKey.Enter, modifiers));

// Action will be ImeNull if AcceptsReturn is true, in which case we return false to allow the new line to register.
// Otherwise we return true to allow the focus to change correctly.
Expand Down