maui icon indicating copy to clipboard operation
maui copied to clipboard

Picker doesn't show options in modal

Open kreitje opened this issue 2 years ago • 2 comments

Description

When nagivgation to a page that has Shell.PresentationMode="Modal" or Shell.PresentationMode="ModalAnimated" you are not able to pick options. Remove the Shell.PresentationMode attribute show it navigates like a page, and the options will show.

maui-picker .

Steps to Reproduce

  1. Create a new .NET Maui project
  2. Add a new page with a picker
<Picker.Items>
    <x:String>Baboon</x:String>
    <x:String>Capuchin Monkey</x:String>
    <x:String>Blue Monkey</x:String>
    <x:String>Squirrel Monkey</x:String>
    <x:String>Golden Lion Tamarin</x:String>
    <x:String>Howler Monkey</x:String>
    <x:String>Japanese Macaque</x:String>
  </Picker.Items>
</Picker>
  1. Run the app
  2. From the main page, navigate to this new page.
  3. Click the picker and you can see the drop downs
  4. Stop the app
  5. Edit the new pages xaml adding Shell.PresentationMode="ModalAnimated" to the ContentPage element.
  6. Run the app
  7. From the main page, navigate to this new page. This should open in a modal
  8. Click the picker and none of the options show up

Version with bug

Release Candidate 1 (current)

Last version that worked well

Unknown/Other

Affected platforms

macOS

Affected platform versions

net6.0-maccatalyst15.4.100-rc.1.125, Mac OS 12.3.1

Did you find any workaround?

Don't use the picker on a page being displayed as a modal.

Relevant log output

Nothing relevant shows up

kreitje avatar Apr 14 '22 15:04 kreitje

repro on our Mac. Here is an example: MauiApp6101.zip

VincentBu avatar Apr 15 '22 02:04 VincentBu

I've found this issue is a problem on regular non-shell ContentPages as well. I'd initially thought it was related to the alerts not displaying on modal pages issue, but with that resolved, this seems to still be an issue.

With no workaround, I'm limited in testing on MacCatalyst.

agendamatic avatar Aug 09 '22 15:08 agendamatic

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

ghost avatar Aug 30 '22 15:08 ghost

For what it's worth, I've implemented a workaround that allows for testing, but it's unsuitable for production. I created a handler for Picker on MacCatalyst that adds a TapGestureRecognizer containing a command that increments the picker selected index (and resetting to zero when needed). I can now change the selected item by clicking on the picker.

public class PickerHandler : Microsoft.Maui.Handlers.PickerHandler
{
    public override void SetVirtualView(IView view) {
        base.SetVirtualView(view);

        // optionally check if this is a modal page here...

        var picker = view as Picker;
        picker.GestureRecognizers.Add(new TapGestureRecognizer {
            Command = new Command(() =>
                picker.SelectedIndex = (picker.SelectedIndex + 1) % picker.Items.Count)
        });
    }
}

As I said, inelegant, but it works.

agendamatic avatar Apr 21 '23 19:04 agendamatic

Verified this issue with Visual Studio for Mac 17.6 Preview (17.6.0.1569). When Shell.PresentationMode="Modal" or Shell.PresentationMode="ModalAnimated", Can repro it on macOS platform with sample Project. MauiApp6101.zip. But remove the attribute, still not able to pick options

jinxinjuan avatar Jul 03 '23 08:07 jinxinjuan

Any progress on this?

drossoft avatar Aug 18 '23 10:08 drossoft