-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[iOS, Mac] Fix for CursorPosition not updating when typing into Entry control #30505
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
base: main
Are you sure you want to change the base?
Conversation
Hey there @@SyedAbdulAzeemSF4852! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
/azp run MAUI-UITests-public |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this 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 ensures the CursorPosition
on the Entry
control stays in sync when typing on iOS (and Mac Catalyst) by calling a new extension method and validating the behavior with a UI test.
- Added an
UpdateCursorPosition
extension inITextInputExtensions
to update the cursor when it changes. - Updated
EntryHandler.iOS
to invokeUpdateCursorPosition
duringOnEditingChanged
. - Introduced a HostApp page and a shared UI test (
Issue20911
) to verify that typing into anEntry
updates its cursor position.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
File | Description |
---|---|
src/Core/src/Handlers/Entry/EntryHandler.iOS.cs | Invoke UpdateCursorPosition after updating text in OnEditingChanged |
src/Core/src/Core/Extensions/ITextInputExtensions.cs | Add UpdateCursorPosition extension method to sync cursor position |
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20911.cs | Add UI test to enter text and verify the cursor position |
src/Controls/tests/TestCases.HostApp/Issues/Issue20911.cs | Create HostApp page with an Entry , status Label , and validation Button |
Comments suppressed due to low confidence (2)
src/Controls/tests/TestCases.HostApp/Issues/Issue20911.cs:7
- [nitpick] The variable name
cursorPositonStatusLabel
has a typo. Consider renaming it tocursorPositionStatusLabel
for consistency and clarity.
Label cursorPositonStatusLabel;
src/Core/src/Core/Extensions/ITextInputExtensions.cs:45
- Consider adding unit tests for
UpdateCursorPosition
to verify that it correctly updates theCursorPosition
when it differs and does nothing when positions are equal.
internal static void UpdateCursorPosition(this ITextInput textInput, int cursorPosition)
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Issue Details
Root Cause
Description of Change
Issues Fixed
Fixes #20911
Validated the behaviour in the following platforms
Output
Before.mov
After.mov