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

[Windows] Fix for Scrollview.ScrollTo execution only returns after manual scroll #28528

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

Conversation

HarishwaranVijayakumar
Copy link

@HarishwaranVijayakumar HarishwaranVijayakumar commented Mar 20, 2025

Root Cause of the issue

  • When the scroll offset is set to the same value as the current view, the scroll view doesn't change. As a result, the scroll operation never completes, causing the await method to wait indefinitely. Consequently, the code after the await will not be executed.

Description of Change

  • To address this issue, I have implemented a check to mark the scroll as finished when the requested offset is the same as the current platform offset

Issues Fixed

Fixes #15508

Tested the behaviour in the following platforms

  • Windows
  • Android
  • iOS
  • Mac

Output

Before Fix After Fix
Beforefix_scroll.mp4
Afterfix_scroll.mp4

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Mar 20, 2025
Copy link
Contributor

Hey there @HarishwaranVijayakumar! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@dotnet-policy-service dotnet-policy-service bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Mar 20, 2025
@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@HarishwaranVijayakumar HarishwaranVijayakumar marked this pull request as ready for review March 20, 2025 10:00
@Copilot Copilot bot review requested due to automatic review settings March 20, 2025 10:00
@HarishwaranVijayakumar HarishwaranVijayakumar requested a review from a team as a code owner March 20, 2025 10:00

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 fixes an issue where ScrollView.ScrollTo on Windows would not complete the operation when the requested offset matched the current offset, causing the await to wait indefinitely.

  • Added automated tests for the issue in both shared tests and the host app.
  • Updated the Windows ScrollViewHandler to immediately mark scrolling as finished when the requested offset matches the current offset.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue15508.cs Added a test that verifies the scroll operation completes as expected.
src/Controls/tests/TestCases.HostApp/Issues/Issue15508.cs Implemented a UI test demonstrating the scroll fix in the host app.
src/Core/src/Handlers/ScrollView/ScrollViewHandler.Windows.cs Updated scroll behavior to handle cases where the current offset matches the requested offset.
Comments suppressed due to low confidence (2)

src/Controls/tests/TestCases.HostApp/Issues/Issue15508.cs:29

  • [nitpick] Consider renaming the local variable _scrollButton to scrollButton for clarity, reserving the underscore prefix for private fields.
Button _scrollButton = new Button

src/Core/src/Handlers/ScrollView/ScrollViewHandler.Windows.cs:77

  • [nitpick] If VerticalOffset and HorizontalOffset are floating point values, consider using an epsilon-based comparison to handle potential precision issues.
if (request.VerticalOffset == handler.PlatformView.VerticalOffset && request.HorizontalOffset == handler.PlatformView.HorizontalOffset)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-scrollview ScrollView community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/windows 🪟
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scrollview.ScrollTo execution only returns after manual scroll
3 participants