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

[Android] Fix for Entry SelectionLength #24064

Merged
merged 14 commits into from
Aug 23, 2024

Conversation

NirmalKumarYuvaraj
Copy link
Contributor

@NirmalKumarYuvaraj NirmalKumarYuvaraj commented Aug 7, 2024

Root Cause

The entry control does not automatically receive focus when the view is attached to the window. It can only be focused when the user taps on it or sets the focus manually, such as by using the Tab key. As a result, the entry does not initially have focus.

Description of Change

Verified the behavior of the Editor control, which is similar to the Entry control. The Editor is functioning as expected, so the code changes were implemented in the Entry control as well.

Reference

Referred code changes from EditorHandler.Android.cs file -

void OnPlatformViewAttachedToWindow(object? sender, ViewAttachedToWindowEventArgs e)
.

Issues Fixed

Fixes #18443

Output

Before

Before.mp4

After

After.mp4

@NirmalKumarYuvaraj NirmalKumarYuvaraj requested a review from a team as a code owner August 7, 2024 10:45
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Aug 7, 2024
Copy link
Contributor

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

@rmarinho
Copy link
Member

rmarinho commented Aug 7, 2024

Can we add a test?

@@ -146,6 +147,16 @@ static void MapFocus(IEntryHandler handler, IEntry entry, object? args)
handler.PlatformView.Focus(request);
}

void OnPlatformViewAttachedToWindow(object? sender, ViewAttachedToWindowEventArgs e)
{
if (PlatformView.IsAlive() && PlatformView.Enabled)
Copy link
Member

Choose a reason for hiding this comment

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

Looks good!

I'm thinking you'll be able to add visual tests for this one. If you can't get an automated test for this PR just let us know and we can add a manual one internally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added visual test for this. Please verify

@rmarinho
Copy link
Member

rmarinho commented Aug 8, 2024

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@NirmalKumarYuvaraj
Copy link
Contributor Author

These code changes will ensure that SelectionLength is correctly applied both during initial loading and at runtime.

@PureWeen
Copy link
Member

PureWeen commented Aug 8, 2024

/azp run

This comment was marked as outdated.

@PureWeen PureWeen assigned samhouts and PureWeen and unassigned PureWeen Aug 8, 2024

This comment was marked as outdated.

@NirmalKumarYuvaraj
Copy link
Contributor Author

The issue occurs only on the Android platform, so the test case is added only for Android.

This comment was marked as outdated.

@NirmalKumarYuvaraj
Copy link
Contributor Author

@jfversluis , Could you please review the recent changes and trigger the pipeline.

This comment was marked as outdated.

This comment was marked as outdated.

@PureWeen
Copy link
Member

PureWeen commented Aug 13, 2024

/azp run

This comment was marked as outdated.

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@NirmalKumarYuvaraj
Copy link
Contributor Author

@dotnet-policy-service agree

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@rmarinho
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@rmarinho
Copy link
Member

rmarinho commented Aug 22, 2024

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen PureWeen enabled auto-merge (squash) August 22, 2024 18:14
@PureWeen PureWeen disabled auto-merge August 22, 2024 19:12
@PureWeen PureWeen enabled auto-merge (squash) August 22, 2024 19:12
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen
Copy link
Member

Failing test is unrelated

@PureWeen PureWeen disabled auto-merge August 23, 2024 15:34
@PureWeen PureWeen merged commit ebf7604 into dotnet:main Aug 23, 2024
95 of 97 checks passed
@samhouts samhouts added the fixed-in-net8.0-nightly This may be available in a nightly release! label Aug 27, 2024
@samhouts samhouts added the fixed-in-net9.0-nightly This may be available in a nightly release! label Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community ✨ Community Contribution fixed-in-net8.0-nightly This may be available in a nightly release! fixed-in-net9.0-nightly This may be available in a nightly release!
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

SelectionLength Property Not Applied to Entry at Runtime
5 participants