Skip to content

Commit

Permalink
[iOS] Read only Editor is editable when Next from on screen keyboard (#…
Browse files Browse the repository at this point in the history
…22501)

* Fix #22079

* Added a device test #22079
  • Loading branch information
kubaflo authored Jul 13, 2024
1 parent 79dd879 commit ba19cff
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Core/src/Platform/iOS/KeyboardAutoManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ internal static void GoToNextResponderOrResign(UIView view, UIView? customSuperV

var nextField = view.FindNextView(superview, view =>
{
var isValidTextView = view is UITextView textView && textView.Editable;
var isValidTextView = view is UITextView textView && textView.Editable && textView.UserInteractionEnabled;
var isValidTextField = view is UITextField textField && textField.Enabled;

return (isValidTextView || isValidTextField) && !view.Hidden && view.Alpha != 0f;
Expand Down
29 changes: 29 additions & 0 deletions src/Core/tests/DeviceTests/Handlers/Entry/EntryHandlerTests.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,35 @@ await NextMovesHelper(() =>
}, vsl1, vsl2, vsl3);
}

[Fact]
public async Task NextMovesSkipsReadonlyFields()
{
var entry1 = new EntryStub
{
ReturnType = ReturnType.Next,
};

var editor1 = new EditorStub
{
IsReadOnly = true
};

var editor2 = new EditorStub();

var vsl = new VerticalStackLayoutStub
{
entry1,
editor1,
editor2
};

await NextMovesHelper(() =>
{
KeyboardAutoManager.GoToNextResponderOrResign(entry1.ToPlatform(), customSuperView: vsl.ToPlatform().Superview);
Assert.True(editor2.IsFocused);
}, vsl);
}

async Task NextMovesHelper(Action action = null, params StubBase[] views)
{
EnsureHandlerCreated(builder =>
Expand Down

0 comments on commit ba19cff

Please sign in to comment.