maui
maui copied to clipboard
Picker doesn't show options in modal
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.

Steps to Reproduce
- Create a new .NET Maui project
- 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>
- Run the app
- From the main page, navigate to this new page.
- Click the picker and you can see the drop downs
- Stop the app
- Edit the new pages xaml adding
Shell.PresentationMode="ModalAnimated"
to the ContentPage element. - Run the app
- From the main page, navigate to this new page. This should open in a modal
- 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
repro on our Mac. Here is an example: MauiApp6101.zip
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.
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.
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.
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
Any progress on this?