Skip to content

[iOS] Fix wrong scrolling options using the ScrollView Orientation property #30131

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

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

jsuarezruiz
Copy link
Contributor

Description of Change

The PR include the following changes:

  • Added a new UpdateOrientation extension method to update bounce and scrollbar visibility based on ScrollOrientation.
  • Modify the iOS MauiScrollView control to adjust contentSize based on the scroll orientation.

These changes fix inconsistencies between layout sizing and scroll behavior on iOS. Additionally, this PR includes device tests and UI tests to validate the expected behavior and guard against regressions.

Issues Fixed

Fixes #30070

@jsuarezruiz jsuarezruiz added t/bug Something isn't working platform/ios area-controls-scrollview ScrollView labels Jun 23, 2025
@jsuarezruiz jsuarezruiz marked this pull request as ready for review July 3, 2025 11:53
@Copilot Copilot AI review requested due to automatic review settings July 3, 2025 11:53
@jsuarezruiz jsuarezruiz requested a review from a team as a code owner July 3, 2025 11:53
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the iOS ScrollView by updating its bounce behavior, scrollbar visibility, and content sizing based on the Orientation property, and adds device/UI tests to prevent regressions.

  • Introduces UpdateOrientation extension to set bounce and indicator visibility.
  • Modifies MauiScrollView to constrain content size per orientation.
  • Adds device tests and a UI test page for issue #30070.

Reviewed Changes

Copilot reviewed 10 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Core/tests/DeviceTests/Handlers/ScrollView/ScrollViewHandlerTests.iOS.cs Adds orientation-based bounce tests
src/Core/src/Platform/iOS/ScrollViewExtensions.cs Implements UpdateOrientation extension
src/Core/src/Platform/iOS/MauiScrollView.cs Adjusts contentSize in LayoutSubviews via ApplyOrientationConstraints
src/Core/src/Handlers/ScrollView/ScrollViewHandler.iOS.cs Sets up VirtualView and calls UpdateOrientation in mapper
src/Core/src/Handlers/ScrollView/ScrollViewHandler.cs Adds MapOrientation to property mapper
src/Core/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt Registers new UpdateOrientation API
src/Core/src/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt Registers new UpdateOrientation API
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue30070.cs Adds a UI test for horizontal scrolling behavior
src/Controls/tests/TestCases.HostApp/Issues/Issue30070.xaml Creates test page with a horizontal ScrollView and content toggles
src/Controls/tests/TestCases.HostApp/Issues/Issue30070.xaml.cs Implements test page view-model and button handlers
Comments suppressed due to low confidence (1)

src/Core/tests/DeviceTests/Handlers/ScrollView/ScrollViewHandlerTests.iOS.cs:47

  • The tests verify bounce behavior and scroll enabling, but do not assert the visibility of the horizontal/vertical scroll indicators; consider adding Assert.Equal(expectedShowHorizontal, scrollViewHandler.PlatformView.ShowsHorizontalScrollIndicator) and its vertical counterpart to fully cover the new behavior.
					Assert.Equal(expectedHorizontalBounce, scrollViewHandler.PlatformView.AlwaysBounceHorizontal);

<Button Text="Editor"
Clicked="OnContentTypeButtonClicked"
WidthRequest="100"
AutomationId="GridContentBtn"/>
Copy link
Preview

Copilot AI Jul 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Editor button reuses the "GridContentBtn" AutomationId, causing a duplicate; assign a unique AutomationId (e.g. "EditorContentBtn") to ensure UI tests can target each control correctly.

Copilot uses AI. Check for mistakes.

@@ -61,5 +61,36 @@ public static void UpdateIsEnabled(this UIScrollView nativeScrollView, IScrollVi
nativeScrollView.ScrollEnabled = scrollView.IsEnabled;
}
}

public static void UpdateOrientation(this UIScrollView nativeScrollView, IScrollView scrollView)
Copy link
Preview

Copilot AI Jul 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A new public extension method UpdateOrientation was added; please update the corresponding XML documentation in /docs/ to describe this method and its behavior so public API docs stay in sync.

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-scrollview ScrollView platform/ios t/bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[iOS] ScrollView Orientation set to Horizontal allows both horizontal and vertical scrolling .
1 participant