Popup with an Entry or Pickup in it goes off screen when KB comes up
Current Behavior
If I place an Entry or Picker control in a Popup, as soon as the soft keyboard shows up, the Popup goes off screen.
This was working fine before when the app was targeting .NET 7 and the previous version of CommunityToolkit.Maui. To see what maybe causing the issue, I downgraded CommunityToolkit.Maui to 6.1.0 and the app still targeting .NET 8 and the issue persisted. I then changed the TFM to .NET 7 and the issue disappeared. So the issue seems to have someting to do with .NET 8 OR CommunityToolkit.Maui's interaction with .NET 8.
Here's what it looks like:
https://github.com/CommunityToolkit/Maui/assets/15844030/ba5ecc87-38ed-4fc3-a1df-0e7c922a9f8e
Expected Behavior
The Popup should just slide up as it used to.
Steps To Reproduce
- Create a
Popupin a .NET MAUI app targeting .NET 8 and usingCommunityToolkit.Mauiv7 - Place an
Entrycontrol in it. BTW, aPickercontrol would produce the same issue. Looks like any control that opens up the keybaord would produce the same issue - Run the app iOS device
- Open the
Popupand tap onEntryto bring up the soft keyboard
Link to public reproduction project repository
https://github.com/iQuestLLC/test-maui
Environment
- .NET MAUI CommunityToolkit: 7.0.0
- OS: iOS 17.1.1
- .NET MAUI: .NET 8
Anything else?
Somebody on X mentioned this and it actually works nicely as a workaround: https://x.com/LachMaksymilian/status/1727792653570384313?s=20
using Microsoft.Maui.Platform;
...
// Before we open the Popup, we "Disconnect" KeyboardAutoManagerScroll
#if IOS
KeyboardAutoManagerScroll.Disconnect();
#endif
var popup = new MyPopUp();
var response = await Application.Current.MainPage.ShowPopupAsync(popup);
// Once done with the Popup, we "Connect" KeyboardAutoManagerScroll again
#if IOS
KeyboardAutoManagerScroll.Connect();
#endif
No response
I also verified, but it did not occur in .NET 7. This is likely due to the new scrolling feature added in .NET 8. https://github.com/dotnet/maui/issues/16784
It seems that the only way to turn off the new scrolling feature is to call the Disconnect method of the KeyboardAutoManagerScroll class.
Below are the verification results with .NET 7.
https://github.com/CommunityToolkit/Maui/assets/125236133/6261cf26-291e-4dad-a2c4-fb1e285cc668
This issue has been fixed using the latest version from .NET MAUI Community Toolkit 9.0.2 and .NET MAUI 8.0.70. I'm closing this issue.