Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] CollectionView gets moved when keyboard or picker show up #21630

Closed
MichaelShapiro opened this issue Apr 3, 2024 · 7 comments · Fixed by #21806
Closed

[iOS] CollectionView gets moved when keyboard or picker show up #21630

MichaelShapiro opened this issue Apr 3, 2024 · 7 comments · Fixed by #21806
Assignees
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView area-controls-picker Picker fixed-in-8.0.21 fixed-in-9.0.0-preview.5.24307.10 i/regression This issue described a confirmed regression on a currently supported version platform/iOS 🍎 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@MichaelShapiro
Copy link

MichaelShapiro commented Apr 3, 2024

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:(

IMG_0023.MOV

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

@MichaelShapiro MichaelShapiro added the t/bug Something isn't working label Apr 3, 2024
@ewerspej
Copy link

ewerspej commented Apr 4, 2024

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?

@MichaelShapiro
Copy link
Author

@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.

@ewerspej
Copy link

ewerspej commented Apr 4, 2024

@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

@RoiChen001
Copy link

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.

@RoiChen001 RoiChen001 added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed i/regression This issue described a confirmed regression on a currently supported version labels Apr 8, 2024
@PureWeen
Copy link
Member

PureWeen commented Apr 9, 2024

@tj-devel709 thoughts?

@PureWeen PureWeen added this to the .NET 8 SR4 milestone Apr 9, 2024
@tj-devel709
Copy link
Contributor

tj-devel709 commented Apr 12, 2024

@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?

@tj-devel709
Copy link
Contributor

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!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView area-controls-picker Picker fixed-in-8.0.21 fixed-in-9.0.0-preview.5.24307.10 i/regression This issue described a confirmed regression on a currently supported version platform/iOS 🍎 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

6 participants