maui
maui copied to clipboard
[iOS] CollectionView gets moved when keyboard or picker show up
Description
This is/might be related to a recent fix in MAUI 8.0.10 #19875
If the page has the default KeyboardAutoManagerScroll behavior (enabled/Connected) then CollectionView is moved down when the keyboard or picker, that is triggered from TitleView (outside of the ContentPage.Content), shows up.
The first two boxes are in the CollectionView's header - they work as expected thanks to #19875 fix. The top two boxes are in the TitleView - they don't behave good:(
https://github.com/dotnet/maui/assets/36049508/63f222d7-7a03-4a89-9edb-527e7c461be4
Steps to Reproduce
Run the repo posted below
Link to public reproduction project repository
https://github.com/MichaelShapiro/MauiBugs/tree/master/KeyboardMakesPageShift
Version with bug
8.0.10 SR3
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
8.0.3 GA
Affected platforms
iOS
Affected platform versions
No response
Did you find any workaround?
Yes, I had to use KeyboardAutoManagerScroll.Disconnect() for that page to prevent ScrollView from moving down.
Relevant log output
No response
I'm experiencing a similar issue with the CollectionView being pushed upward on iOS and it's very annoying, because I cannot see what/where I'm typing. Does your workaround come with any unwatend side effects?
@ewerspej When I KeyboardAutoManagerScroll.Disconnect() on that page the behavior is as follows: jumping stops. keyboard/picker pops up on top of any elements in the bottom portion of the page.
@MichaelShapiro I tried it and it doesn't help with my problem, I need the bottom elements to be visible. I have a CollectionView and if there are only a few items, they disappear at the top when the page is pushed up. That way, I cannot see new items being added via an Entry at the bottom of the page.
Update: I found a solution workaround that works by using the KeyboardAutoManagerScroll.Disconnect()
in combination with subscribing to the UIKeyboardWillShowNotification like I also describe in this Stack Overflow answer:
#if IOS
UIKit.UIKeyboard.Notifications.ObserveWillShow((sender, args) =>
{
var keyboardHeight = (double)args.FrameEnd.Height;
SomeView.TranslationY = keyboardHeight;
});
UIKit.UIKeyboard.Notifications.ObserveWillHide((sender, args) =>
{
SomeView.TranslationY = 0;
});
#endif
Can repro this issue on the latest 17.10.0 preview 2(8.0.14), but can't repro it on 8.0.6&8.0.7.
@tj-devel709 thoughts?
@MichaelShapiro I tried it and it doesn't help with my problem, I need the bottom elements to be visible. I have a CollectionView and if there are only a few items, they disappear at the top when the page is pushed up. That way, I cannot see new items being added via an Entry at the bottom of the page.
Update: I found a solution workaround that works by using the
KeyboardAutoManagerScroll.Disconnect()
in combination with subscribing to the UIKeyboardWillShowNotification like I also describe in this Stack Overflow answer:#if IOS UIKit.UIKeyboard.Notifications.ObserveWillShow((sender, args) => { var keyboardHeight = (double)args.FrameEnd.Height; SomeView.TranslationY = keyboardHeight; }); UIKit.UIKeyboard.Notifications.ObserveWillHide((sender, args) => { SomeView.TranslationY = 0; }); #endif
This sounds like a separate issue, could you please open a new issue and include a reproducible sample / image gif of what you are seeing?
Also what version are you using?
As for the scrolling with the controls in the NavBar, I believe I have a quick solution and will create a PR for shortly! Thanks!