Ignore ScrollRectToVisible if KeyboardAutoManagerScroll is enabled in ItemsViewController#19875
Conversation
…ManagerScroll is enabled
|
Hey there @artemvalieiev! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Currently working on a UITest for this one! |
…ctionView-Header-gets-moved-on-input-field
| nfloat navigationBarAreaHeight; | ||
|
|
||
| if (ContainerView.GetNavigationController() is UINavigationController navigationController) | ||
| if (View.FindResponder<UINavigationController>() is UINavigationController navigationController) |
There was a problem hiding this comment.
Small change in my scrolling code here to use the current UINavigationController instead of the top-most one in case there are multiple UINavigationControllers. This presented an issue from building the UITest for this PR!
mattleibow
left a comment
There was a problem hiding this comment.
Looks good, just have some qwuestions on the public API and new types being used.
|
|
||
| namespace Microsoft.Maui.Platform; | ||
|
|
||
| public class MauiCollectionView : UICollectionView |
There was a problem hiding this comment.
This is a new API and I am not sure what the rules are for servicing. Maybe this can be internal for now?
There was a problem hiding this comment.
You are right. There is no reason to have this “public”, I set it to “public” out of habit without thinking.
…CollectionView-Header-gets-moved-on-input-field
…ems from Controls.Core.Handlers.Items
tj-devel709
left a comment
There was a problem hiding this comment.
Looking good to me! Worth noting that the issue is present in Catalyst as well and this PR fixes the issue there as well
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Description of Change
Focusing on any input field placed in the header currently makes UICollectionView change its offset. I tried to find what exact method changes contentoffset/contentinset, but I was not able to find a reason until I checked NSThread.NativeCallStack to check who invokes SetContentOffset and noticed this

[23]: "23 UIKitCore 0x000000018560caa8 -[UITextField scrollTextFieldToVisibleIfNecessary] + 300"
[24]: "24 UIKitCore 0x000000018560cb70 -[UITextField becomeFirstResponder] + 164"
[UITextField scrollTextFieldToVisibleIfNecessary] is a private API method that is invoked internally in UIKit by Apple on becomeFirstResponder, which invokes ScrollToRect, which triggers SetContentOffset.
I wanted to avoid overriding ScrollToRectVisiblet. However, it is not used internally, and all scrolling happens directly by changing the content offset and doesn't affect snapping points, scrolling to the item, and other functionality. The only place that uses this ScrollToRectVisible in MAUI is in MauiScrollView that and does the same override to fix scroll behavior for input fields.
Issues Fixed
Fixes #10947
This issue also is present in XF xamarin/Xamarin.Forms#9879 xamarin/Xamarin.Forms#13927
Video
before
before_fix.mov
after
after_fix.mov