maui
maui copied to clipboard
iOS - Keyboard changes page layout, and doesn't always return back to normal
Description
When the keyboard is opened the screen layout changes, when it closes, it doesn't always return back to the normal layout.
See in the below video, the next and back buttons are at the bottom of the screen, when the keyboard opens they are moved up, and sometimes get stuck -
https://github.com/user-attachments/assets/32e62f02-d536-454c-8b0d-3ea87526dfb6
Steps to Reproduce
No response
Link to public reproduction project repository
No response
Version with bug
8.0.90 SR9
Is this a regression from previous behavior?
Yes, this used to work in Xamarin.Forms
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
No response
Did you find any workaround?
No response
Relevant log output
No response
I have a similar issue with CollectionView. It only occurs when opening the keyboard causes a scroll bar to appear and there wasn't one before.
@tj-devel709 here is the repo - https://github.com/IeuanWalker/Maui-iOS-Layout-issue-25185
Looks like the cause is if there is enough space above the editor that when the keyboard it opened it causes the scrollview to kick in.
In the repo there are 2 repos
- Basic
- This uses just Maui controls and the minimum to repo the issue
- If you switch the red boxview and the editor around, you don't get the issue. Looks like it only happens when the editor is towards the bottom of the screen, and opening the keyboard triggeres the scrollview to scroll.
- Full repo
- This is the full layout used by our app
- Seams a bit more glitchier than the basic version
Here is a vid showing the repo app - https://github.com/user-attachments/assets/5a6805a6-e02e-473c-aa59-a7aeea2ec5f2
You can see that the blue BoxView randomly gets stuck after the keyboard is opened, and doesn't return to the bottom.
I can repro it at iOS platform on the latest 17.12.0 Preview 3.0(8.0.92 & 8.0.90).
I confirm this exist in 8.0.92
cc @tj-devel709
@jsuarezruiz @tj-devel709 any update on this?
I've just hit this issue on iOS, Android seems OK - do we have any workarounds?
None that i know of :/
First maui bug ive come across without any workaround, and its also the most impactful UX issue we've seen.
Hi, same issue here on 9.0.40
@IeuanWalker Here u have workaround:
public class CustomEntryHandler : EntryHandler
{
protected override void ConnectHandler(MauiTextField platformView)
{
base.ConnectHandler(platformView);
(VirtualView as Entry)!.Unfocused += OnUnfocused;
}
private void OnUnfocused(object? sender, FocusEventArgs e)
{
Element element = e.VisualElement;
while (element is not Page)
{
element = element.Parent;
if (element is ScrollView scrollView)
{
scrollView.InvalidateMeasure();
return;
}
}
}
protected override void DisconnectHandler(MauiTextField platformView)
{
(VirtualView as Entry)!.Unfocused -= OnUnfocused;
base.DisconnectHandler(platformView);
}
}