KEMBAR78
[Android] Pickers reopen when the selected item is re-selected · Issue #19739 · dotnet/maui · GitHub
Skip to content

[Android] Pickers reopen when the selected item is re-selected #19739

@mfeingol

Description

@mfeingol

Description

Pickers reopen after selecting an item that's already selected. Easy to observe with a picker with only one item.

I suspect the problem comes from the code that reopens the picker on focus change: https://github.com/dotnet/maui/blob/main/src/Core/src/Handlers/Picker/PickerHandler.Android.cs#L94

Steps to Reproduce

  1. Make a new MAUI project
  2. Add some pickers to the page. Having multiple ones seems to exacerbate the issue. Also having ones with only one item.
  3. Tap on the pickers and re-select the selected item
  4. Observe the pickers reopen after selection

Link to public reproduction project repository

https://github.com/mfeingol/repros/tree/master/PickerFocusRepro

Version with bug

8.0.3

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 13

Did you find any workaround?

A workaround is to do this:

    class CustomPicker : Picker
    {
        public CustomPicker()
        {
            // Maui: work around https://github.com/dotnet/maui/issues/15394
            this.Focused += (s, e) => this.Unfocus();
        }
    }

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-controls-pickerPickermigration-compatibilityXamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convertplatform/androids/needs-attentionIssue has more information and needs another looks/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions