-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
base: main
Are you sure you want to change the base?
[Android] TimePicker focus & unfocus events #26949
Conversation
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. |
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.
@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?
@@ -101,15 +118,17 @@ void ShowPickerDialog(int hour, int minute) | |||
{ | |||
_dialog = CreateTimePickerDialog(hour, minute); | |||
_dialog.Show(); | |||
VirtualView.IsFocused = true; |
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.
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:
maui/src/Core/src/Handlers/Entry/EntryHandler.Android.cs
Lines 152 to 156 in 46096ff
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:
maui/src/Controls/src/Core/Entry/Entry.Mapper.cs
Lines 23 to 29 in 46096ff
#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...
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.
I've added it so that focus is activated when the dialog is opened. Without it the control never recognises its focus status
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Issues Fixed
Fixes #26908