maui
maui copied to clipboard
Fix ScrollToPosition.Center behavior in ScrollView on iOS and MacCatalyst
Issue Details
When scrolling a ScrollView using the ScrollToAsync method with the ScrollPosition.Center value, the item is incorrectly centered.
Root Cause
The scroll offset values allow items to scroll into a negative position, causing the item to be incorrectly centered.
Description of Change
We clamp the scroll offset values to ensure the item does not scroll into a negative position.
Issues Fixed
Fixes #26760 Fixes #28965
Validated the behaviour in the following platforms
- [x] Android
- [x] Windows
- [x] iOS
- [x] Mac
Output Screenshot
| Before | After |
|---|---|
/azp run
Azure Pipelines successfully started running 3 pipeline(s).
Azure Pipelines successfully started running 3 pipeline(s).
Azure Pipelines successfully started running 3 pipeline(s).
/rebase
Azure Pipelines successfully started running 3 pipeline(s).
The test ScrollToElement3End fails with small changes on Mac and iOS:
Could you review it and see if is related with the changes?
@jsuarezruiz, Yes, the test failure is related to my changes, and the snapshot has a slight difference. Shall I commit the newly generated image?
/rebase
The test ScrollToElement3End fails with small changes on Mac and iOS:
Could you review it and see if is related with the changes?
@jsuarezruiz, Yes, the test failure is related to my changes, and the snapshot has a slight difference. Shall I commit the newly generated image?
Yes, thanks in advance.
/azp run
Azure Pipelines successfully started running 3 pipeline(s).
/rebase
/azp run
Azure Pipelines successfully started running 3 pipeline(s).
/rebase
/azp run
Azure Pipelines successfully started running 3 pipeline(s).
/rebase
/azp run
Azure Pipelines successfully started running 3 pipeline(s).
/azp run
Azure Pipelines successfully started running 3 pipeline(s).
Fix conflict
@PureWeen, I have resolved the conflicts.
/azp run MAUI-UITests-public
Azure Pipelines successfully started running 1 pipeline(s).
/rebase
/azp run MAUI-UITests-public
Azure Pipelines successfully started running 1 pipeline(s).
