maui
maui copied to clipboard
[iOS] Handle focus changes for UIButton
Description of Change
Handle button focus changes for UIButton
code to test on maccatalyst, make sure all events fire when for example using tab key
<StackLayout>
<Label Text="Does this can be focused?"/>
<Entry Text="Focus Entry" Focused="EntryFocused" Unfocused="EntryUnfocused" />
<Button Text="Focus Button" Focused="BtnFocused" Unfocused="BtnUnfocused" />
<Label Text="Seems to work" />
</StackLayout>
Issues Fixed
Fixes #6482
Tried to add Device tests but it didn't work ..
[Fact(DisplayName = "Focused event Fires")]
public async Task FocusFires()
{
var button = new ButtonStub();
var nativeButtonFocused = await GetValueAsync((IView)button,
handler =>
{
var mauiBtn = handler.PlatformView as Microsoft.Maui.Platform.MauiButton;
mauiBtn.Focus(new FocusRequest(true));
mauiBtn.BecomeFirstResponder();
return handler.PlatformView.Focused;
});
Assert.True(nativeButtonFocused);
Assert.True(button.IsFocused);
}
There is no buttondelegate or controlfocusdelegate?
@PureWeen we are stuck on this failing test because there's no way to remove the observer when setting the handler just to null.
So i guess this is blocked on:
- DisconnectHandler not being called on iOS
- Also the MemoryTests don't take in account a way to remove the subscription since they only set the handler to null
Ideas @PureWeen ?
:warning: Your code has been reformatted. :warning:
So i guess this is blocked on:
- DisconnectHandler not being called on iOS
- Also the MemoryTests don't take in account a way to remove the subscription since they only set the handler to null
Ideas @PureWeen ?
Is still blocked by this?, could I help in some way?
Hi @rmarinho. We have added the "s/pr-needs-author-input" label to this issue, which indicates that we have an open question/action for you before we can take further action. This PRwill be closed automatically in 14 days if we do not hear back from you by then - please feel free to re-open it if you come back to this PR after that time.
Hi @rmarinho.
It seems you haven't touched this PR for the last two weeks. To avoid accumulating old PRs, we're marking it as stale. As a result, it will be closed if no further activity occurs within 4 days of this comment. You can learn more about our Issue Management Policies here.