Skip to content

[iOS] Fix Editor control does not scroll properly on iOS when enclosed in a Border control.#24683

Closed
Tamilarasan-Paranthaman wants to merge 6 commits intodotnet:mainfrom
Tamilarasan-Paranthaman:fix-20736
Closed

[iOS] Fix Editor control does not scroll properly on iOS when enclosed in a Border control.#24683
Tamilarasan-Paranthaman wants to merge 6 commits intodotnet:mainfrom
Tamilarasan-Paranthaman:fix-20736

Conversation

@Tamilarasan-Paranthaman
Copy link
Copy Markdown
Member

@Tamilarasan-Paranthaman Tamilarasan-Paranthaman commented Sep 10, 2024

Root Cause:

  • On iOS, when the Editor control is enclosed in a Border, the Border's ClipPath bounds cause only the initial content of the Editor to be visible. If the Editor is scrollable, the offset does not update correctly during vertical scrolling. As a result, only the initial content is visible during scrolling, while the rest of the view remains hidden.

Description of Change:

  • To address this, I wrapped the platform view UITextView in a container on the handler when it is inside a Border, similar to how we handled UIScrollView in the following reference.

Validated the behaviour in the following platforms,

  • Android
  • Windows
  • iOS
  • Mac

Reference

Issues Fixed

Fixes #20736
Fixes #18486

Screenshots

Before Issue Fix After Issue Fix
Screen.Recording-issue.mov
Screen.Recording.mov

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Sep 10, 2024
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

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

@Tamilarasan-Paranthaman Tamilarasan-Paranthaman changed the title Fix 20736 [iOS] Fix Editor control does not scroll properly on iOS when enclosed in a Border control. Sep 10, 2024
@jfversluis
Copy link
Copy Markdown
Member

jfversluis commented Sep 10, 2024

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@last-Programmer
Copy link
Copy Markdown

This is blocking me to migrate to border conrol from frame. with editor inside frame it is working fine. now the frame is deprecated in .net 9 and need to migrate to border. but without this fix we cant migrate. WIll it be fixed when .net 9 released.

thanks

Copy link
Copy Markdown
Member

@PureWeen PureWeen left a comment

Choose a reason for hiding this comment

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

I ran the attached uitest without the fix and it doesn't reproduce the issue.

It looks like it has to be inside a layout in order for it to reproduce

  <VerticalStackLayout>
            <Border Stroke="LightGray">
                <Editor  HeightRequest="100"
                         Text="Line 1&#xa;Line 2&#xa;Line 3&#xa;Line 4&#xa;Line 5&#xa;Line 6&#xa;Line 7&#xa;" />
            </Border>
        </VerticalStackLayout>

If I remove the VSL then it no longer cuts. Which also makes me wonder if this is the correct fix.

I worry about the EditorHandler having to inspect the parent to know if it needs a container. This fix feels a little bit like it's not resolving the core issue

@Tamilarasan-Paranthaman
Copy link
Copy Markdown
Member Author

@PureWeen, without the VerticalStackLayout, the Border will occupy the full height, and the issue only occurs when the editor's content height exceeds the content mask height. If you scroll the Editor with only 7 lines and without the VerticalStackLayout, the editor's content height will not extend beyond the content mask height. This issue typically appears after adding around 28 or 29 lines in this scenario.

However, you can still reproduce the issue without the VerticalStackLayout by setting the Border's HeightRequest to 150, which will reveal the problem when scrolling vertically.

I apologize for the inconvenience. I missed adding the VerticalStackLayout in my test case. Should I include the VerticalStackLayout or set the Border's HeightRequest in my test case? Which option would you recommend?

@cagriy
Copy link
Copy Markdown

cagriy commented Oct 3, 2024

It works fine in Frame if anybody desperately needs rounded corners (or if this helps towards a fix).

@last-Programmer
Copy link
Copy Markdown

@cagriy frame is being deprecated in .net 9. It is recommened to migrate to border since frame is deprecated and will be removed in future versions. Without this fix we cant migrate to border control.

{
// If we are wrapped by a BorderView, we need a container
// to handle masks and clip shapes effectively.
if (VirtualView?.Parent is IBorderView)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't feel like this is the approach we'll want to take here.

  1. Users report that this all works fine with the Frame control
  2. it doesn't feel like Editor should be reaching up to the parent here to figure out if it needs a container. This feels like it's not fixing the root of the problem.

I'm still poking a bit to see if I can figure out a better approach here.

I'm curious if there's a way to fix this inside the BorderView control vs fixing here

@kubaflo
Copy link
Copy Markdown
Contributor

kubaflo commented Oct 4, 2024

Hi! What do you think about this one #25098

{
App.WaitForElement("editor");
App.ScrollDown("editor", ScrollStrategy.Programmatically);
await Task.Delay(1000);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not sure if this will generate the same screenshots every time 🤔

@jsuarezruiz
Copy link
Copy Markdown
Contributor

@Tamilarasan-Paranthaman Could you rebase to fix the conflicts? Thanks in advance.

@sheiksyedm sheiksyedm added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Dec 6, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Feb 9, 2025
@Tamilarasan-Paranthaman Tamilarasan-Paranthaman deleted the fix-20736 branch June 16, 2025 11:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-editor Editor community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/ios

Projects

None yet

8 participants