Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Unable to set focus to button after selecting an Item from Picker #6425

Closed
StuartFergusonVme opened this issue Jun 6, 2019 · 1 comment
Closed
Labels
p/Android s/unverified New report that has yet to be verified t/bug 🐛

Comments

@StuartFergusonVme
Copy link

Description

Unable to set focus to button from a Picker control on item selection.

Steps to Reproduce

  1. Add 3 controls to the main page
    <Entry x:Name="TestEntry" Completed="TestEntry_OnCompleted"></Entry>
    <Picker x:Name="TestPicker" Title="Choose type" Focused="TestPicker_OnFocused" 
                  Unfocused="TestPicker_OnUnfocused">
        <Picker.Items>
            <x:String>Supplier Return</x:String>
            <x:String>Insurance Claim</x:String>
        </Picker.Items>
    </Picker>
    <Button x:Name="SaveButton" Text="Save" Focused="SaveButton_OnFocused" 
                  Clicked="SaveButton_OnClicked"></Button>
  1. Wire up the events as follows:
    private void TestEntry_OnCompleted(Object sender,
                                           EventArgs e)
        {
            this.TestPicker.Focus();
        }

        private void TestPicker_OnFocused(Object sender,
                                          FocusEventArgs e)
        {
            Plugin.Toast.CrossToastPopUp.Current.ShowToastMessage("Picker Focused");
        }

        private void TestPicker_OnUnfocused(Object sender,
                                            FocusEventArgs e)
        {
            Plugin.Toast.CrossToastPopUp.Current.ShowToastMessage("Picker unfocused");
            this.SaveButton.Focus();
        }

        private void SaveButton_OnFocused(Object sender,
                                          FocusEventArgs e)
        {
            Plugin.Toast.CrossToastPopUp.Current.ShowToastMessage("Button Focused");
        }

        private void SaveButton_OnClicked(Object sender,
                                          EventArgs e)
        {
            Plugin.Toast.CrossToastPopUp.Current.ShowToastMessage("Button Clicked");
        }

Expected Behavior

When the user presses enter on the Entry Box the focus moves to the picker.
When the user selects an item from the picker, by pressing enter the focus moves to the button.
When the user selects an item from the picker, by tapping on the item the focus moves to the button.

Actual Behavior

When the user presses enter on the Entry Box the focus moves to the picker.
When the user selects an item from the picker, by pressing enter the focus moves to the button.
When the user selects an item from the picker, by tapping on the item the focus stays on the picker.

Basic Information

  • Version with issue: Xamarin Forms 3.6 & v4.0
  • Last known good version: N/A
  • IDE: Visual Studio 2019
  • Platform Target Frameworks:
    • iOS: N/A
    • Android: 9.0 Pie
    • UWP: N/A
  • Affected Devices: All devices (including emulator)

Reproduction Link

https://github.com/StuartFergusonVme/PickerFocusIssue

@StuartFergusonVme StuartFergusonVme added s/unverified New report that has yet to be verified t/bug 🐛 labels Jun 6, 2019
@samhouts
Copy link
Member

samhouts commented Jun 6, 2019

Duplicate of #5616

@samhouts samhouts marked this as a duplicate of #5616 Jun 6, 2019
@samhouts samhouts closed this as completed Jun 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p/Android s/unverified New report that has yet to be verified t/bug 🐛
Projects
None yet
Development

No branches or pull requests

2 participants