iOS soft-keyboard hides Entry in CollectionView and causes weird jumps
- Dominant language
- C#
- Stars
- 23.3k
- Forks
- 2k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 297
Description
### Description
As you can see, opening a keyboard on one of the last `Entry` component causes weird jump effect, and besides that, it totally breaks the UX.
https://github.com/user-attachments/assets/d9eede6e-7b93-44cd-89a1-5794f9955711
### Steps to Reproduce
Here's the UITest ready for the lucky developer working on this.
```
using Microsoft.Maui.Controls.Shapes;
namespace Maui.Controls.Sample.Issues;
[Issue(IssueTracker.Github, 99999, "iOS soft keyboard causes CollectionView to jump", PlatformAffected.iOS)]
public class Issue99999 : ContentPage
{
public Issue99999()
{
var grid = new Grid();
var cv = new CollectionView { ItemsSource = new List
{
"Item 1",
"Item 2",
"Item 3",
"Item 4",
"Item 5",
"Item 6",
"Item 7",
"Item 8",
"Item 9",
"Item 10"
},
ItemTemplate = new SmallBigTemplateSelector()
};
grid.Add(cv);
Content = grid;
Background = Brush.LightSeaGreen;
}
private class SmallBigTemplateSelector : DataTemplateSelector
{
private readonly DataTemplate _smallTemplate = new(() => CreateTemplateContent(3));
private readonly DataTemplate _bigTemplate = new(() => CreateTemplateContent(15));
static object CreateTemplateContent(int inputCount)
{
var border = new Border
{
StrokeShape = new RoundRectangle { CornerRadius = 16 },
Margin = new Thickness(16),
Background = Brush.White
};
var vsl = new VerticalStackLayout
{
Spacing = 16
};
border.Content = vsl;
var label = new Label
{
FontSize = 24,
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center
};
label.SetBinding(Label.TextProperty, ".");
vsl.Add(label);
for (int i = 0; i < inputCount; i++)
{
var entry = new Entry
{
Placeholder = $"Input {i + 1}",
FontSize = 18,
HeightRequest = 40,
BackgroundColor = Colors.LightGoldenrodYellow,
Margin = new Thickness(16, 0)
};
vsl.Add(entry);
}
return border;
}
protected override DataTemplate OnSelectTemplate(object item, BindableObject container)
{
var str = (string)item;
var numericValue = int.Parse(str.Split(' ')[1]);
return numericValue % 2 == 0 ? _smallTemplate : _bigTemplate;
}
}
}
```
### Link to public reproduction project repository
_No response_
### Version with bug
9.0.70 SR7
### Is this a regression from previous behavior?
Not sure, did not test other versions
### Last version that worked well
Unknown/Other
### Affected platforms
iOS
### Affected platform versions
_No response_
### Did you find any workaround?
No workarounds available.
### Relevant log output
```shell
```
Contributor guide
Assessment
This issue has not been assessed yet.