-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Picker behavior on Mac Catalyst #10208
Comments
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. |
After digging into this a bit, it looks like this is the normal behaviour of the SwiftUI Picker control -- it triggers on a selected item when pausing the scroll and lifting your finger from the mouse for a second. edit: after trying to use the control as-is for a while, I understand why someone chose to make the popup modal -- it is a major pain to have it trigger something if you pause while scrolling. The bug is that the trigger is passed through to the underlying event handler even though the modal popup remains open -- it should only be trigger the event when it closes. I would appreciate it if someone knew of a workaround for this as it has become the one Mac desktop issue I can't find a workaround for as yet. |
Verified this issue with 17.6 Preview (17.6 build 1539). Can repro this issue with sample project. MauiPickerMac |
This was an issue back in Xamarin.Forms with iOS and at least in Xamarin there is an easy fix from the managed code: And actually I found something to fix this for you, that Microsoft shared already for iOS <ContentPage ...
xmlns:ios="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific;assembly=Microsoft.Maui.Controls">
<StackLayout Margin="20">
<Picker ... Title="Select a monkey" ios:Picker.UpdateMode="WhenFinished">
...
</Picker>
...
</StackLayout>
</ContentPage> If you look for mac specific namespace, they don't have the same Picker.UpdateMode exposed yet. BUT, it worked for me on mac catalyst with the above implementation (using iOS specific namespace). If you want to dig deeper, but not really platform specific code deep, there's a hint here: https://github.com/dotnet/maui/blob/main/src/Controls/src/Core/Picker/Picker.iOS.cs And also note that under the Picker folder there are platform specific implementations like: where Picker.Mac doesn't exist. So I think mac catalyst just uses the iOS picker - and that makes sense as MacCatalyst is essentially an iOS app running on Mac. So maybe the fact that you need to invoke iOS specific namespace to alter MacCatalyst behaviour is fine for the most part. If you need separation between Mac/iOS then you can do conditional compilation like suggested here: |
Description
I am not sure why the default behavior of the Picker control on Mac Catalyst is considered acceptable -- it 'functions' but from a desktop app perspective it is unacceptable.
Opening the picker produces a modal scrollable list, which isn't ideal as it won't disappear until the Done button is clicked or you click away into the app. That alone wouldn't be so bad if the SelectedItem didn't follow the scrolling, sending the value to the app even though the user has not 'selected' the item by clicking the item, clicking Done or clicking away. [edit to clarify: if you lift your finger from the mouse to reposition so you can scroll further down the list, the SelectedItem will trigger]
This makes triggering any app action on a change to the SelectedItem impossible (false triggering as they scroll through the list).
Repo demonstrates that the label is updated with the SelectedItem value though data binding, as you scroll through the items.
Steps to Reproduce
in the repo project, open the picker on MacOS, scroll through the values. If you pause briefly, the Label on the right side updates showing that the SelectedItem value has changed through data binding.
MacOS Monterey 12.6,
dotnet version 6.0.401
Link to public reproduction project repository
https://github.com/mike3sullivan/MauiPickerMac
Version with bug
Unknown/Other (please specify)
Last version that worked well
Unknown/Other
Affected platforms
macOS
Affected platform versions
MacOS Monterey 12.6
Did you find any workaround?
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: