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
2 changes: 1 addition & 1 deletion src/Core/src/Platform/iOS/ViewExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ internal static void UpdateLayerBorder(this CoreAnimation.CALayer layer, IButton
{
var sibling = siblings[i];

if (sibling.Subviews is not null && sibling.Subviews.Length > 0)
if (!sibling.Hidden && sibling.Subviews?.Length > 0)
{
var childVal = sibling.Subviews[0].FindNextView(0, isValidType);
if (childVal is not null)
Expand Down
94 changes: 94 additions & 0 deletions src/Core/tests/DeviceTests/Handlers/Entry/EntryHandlerTests.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,100 @@ await NextMovesHelper(() =>
}, entry1, editor, entry2, entry3);
}

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

var entry2 = new EntryStub
{
Visibility = Visibility.Hidden,
ReturnType = ReturnType.Next,
};

var entry3 = new EntryStub
{
ReturnType = ReturnType.Next
};

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

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

var entry2 = new EntryStub
{
ReturnType = ReturnType.Next,
};

var entry3 = new EntryStub
{
ReturnType = ReturnType.Next
};

var vsl1 = new VerticalStackLayoutStub();
vsl1.Add(entry1);
var vsl2 = new VerticalStackLayoutStub { Visibility = Visibility.Hidden };
vsl2.Add(entry2);
var vsl3 = new VerticalStackLayoutStub();
vsl3.Add(entry3);

await NextMovesHelper(() =>
{
KeyboardAutoManager.GoToNextResponderOrResign(entry1.ToPlatform(), customSuperView: vsl1.ToPlatform().Superview);
Assert.True(entry3.IsFocused);
}, vsl1, vsl2, vsl3);
}

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

var entry2 = new EntryStub
{
ReturnType = ReturnType.Next,
};

var entry3 = new EntryStub
{
ReturnType = ReturnType.Next
};

var vsl1 = new VerticalStackLayoutStub();
vsl1.Add(entry1);
var vsl2 = new VerticalStackLayoutStub { Visibility = Visibility.Hidden };
var vsl2_1 = new VerticalStackLayoutStub();
var vsl2_2 = new VerticalStackLayoutStub();
vsl2.Add(vsl2_1);
vsl2_1.Add(vsl2_2);
vsl2_2.Add(entry2);
var vsl3 = new VerticalStackLayoutStub();
vsl3.Add(entry3);

await NextMovesHelper(() =>
{
KeyboardAutoManager.GoToNextResponderOrResign(entry1.ToPlatform(), customSuperView: vsl1.ToPlatform().Superview);
Assert.True(entry3.IsFocused);
}, vsl1, vsl2, vsl3);
}

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