Skip to content

Entry control CursorPosition does not update on TextChanged event [iOS Maui 8.0.7]  #20911

@jurijr

Description

@jurijr

Description

When typing into Entry control on iOS, the CursorPosition property is not updated.
For example output when typing text "Test"

->T expectedPosition[1] actualPosition[0]
T->Te expectedPosition[2] actualPosition[0]
Te->Tes expectedPosition[3] actualPosition[0]
Tes->Test expectedPosition[4] actualPosition[0]

Steps to Reproduce

  1. Add Entry control with TextChanged event
    <Entry TextChanged="Entry_TextChanged" />
  2. Add TextChanged event handler
void Entry_TextChanged(object sender, TextChangedEventArgs e)
    {
		Entry entry = sender as Entry;

#if IOS
        if (entry?.Handler?.PlatformView is UIKit.UITextField entryTextField)
        {
            var position = entryTextField.GetOffsetFromPosition(entryTextField.BeginningOfDocument, entryTextField.SelectedTextRange.Start);

            Console.WriteLine($"'{e.OldTextValue}'->'{e.NewTextValue}' expectedPosition=[{position}] actualPosition=[{entry.CursorPosition}]");
        }
#endif
    }
  1. Observe actualPosition (entry.CursorPosition) does not get updated, compared to native control

Link to public reproduction project repository

No response

Version with bug

8.0.7 SR2

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

No response

Did you find any workaround?

Use position from native UITextField control.

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-controls-entryEntrypartner/syncfusionIssues / PR's with Syncfusion collaborationplatform/iospotential-regressionThis issue described a possible regression on a currently supported version., verification pendings/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions