maui icon indicating copy to clipboard operation
maui copied to clipboard

[iOS] Handle focus changes for UIButton

Open rmarinho opened this issue 3 years ago • 3 comments

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

rmarinho avatar Oct 11 '22 15:10 rmarinho

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);
}

rmarinho avatar Oct 12 '22 18:10 rmarinho

There is no buttondelegate or controlfocusdelegate?

mattleibow avatar Oct 13 '22 00:10 mattleibow

@PureWeen we are stuck on this failing test because there's no way to remove the observer when setting the handler just to null.

rmarinho avatar Oct 14 '22 15:10 rmarinho

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 ?

rmarinho avatar Oct 19 '22 14:10 rmarinho

:warning: Your code has been reformatted. :warning:

github-actions[bot] avatar Feb 15 '23 16:02 github-actions[bot]

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?

jsuarezruiz avatar Jun 19 '23 14:06 jsuarezruiz

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.

ghost avatar Sep 11 '23 22:09 ghost

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.

ghost avatar Sep 29 '23 03:09 ghost