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] TimePicker focus & unfocus events #26949

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

Conversation

kubaflo
Copy link
Contributor

@kubaflo kubaflo commented Jan 3, 2025

Issues Fixed

Fixes #26908

@kubaflo kubaflo requested a review from a team as a code owner January 3, 2025 15:31
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Jan 3, 2025
Copy link
Contributor

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

Copy link
Member

@mattleibow mattleibow left a comment

Choose a reason for hiding this comment

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

@tj-devel709 @PureWeen this PR looks all nice, but since it touches focus and we have all sorts of bits of code, maybe there is a better person to review the focus changes?

src/Controls/tests/TestCases.HostApp/Issues/Issue26908.cs Outdated Show resolved Hide resolved
src/Controls/tests/TestCases.HostApp/Issues/Issue26908.cs Outdated Show resolved Hide resolved
@@ -101,15 +118,17 @@ void ShowPickerDialog(int hour, int minute)
{
_dialog = CreateTimePickerDialog(hour, minute);
_dialog.Show();
VirtualView.IsFocused = true;
Copy link
Member

Choose a reason for hiding this comment

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

Why is this needed here? The maui time p;icker is a text box, so that should work with normal focus commands?

Entry does this:

static void MapFocus(IEntryHandler handler, IEntry entry, object? args)
{
if (args is FocusRequest request)
handler.PlatformView.Focus(request);
}

I also see we double-override it in Controls:

#if IOS || ANDROID
EntryHandler.Mapper.AppendToMapping(nameof(VisualElement.IsFocused), InputView.MapIsFocused);
#endif
#if ANDROID
EntryHandler.CommandMapper.PrependToMapping(nameof(IEntry.Focus), InputView.MapFocus);
#endif

So basically, Focus support is all strage...

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've added it so that focus is activated when the dialog is opened. Without it the control never recognises its focus status

@mattleibow
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen
Copy link
Member

PureWeen commented Jan 6, 2025

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Time Picker Focus Unfocus is not working on Android
3 participants