-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[iOS, Mac] Fix for Picker title is not displayed again when SelectedIndex is set to -1 #30486
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
[iOS, Mac] Fix for Picker title is not displayed again when SelectedIndex is set to -1 #30486
Conversation
|
Hey there @@HarishwaranVijayakumar! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR ensures that when a Picker’s SelectedIndex is reset to –1 on iOS/macOS, the original title (placeholder) is displayed again.
- Clear the native control’s
Textbefore updating the placeholder inUpdatePicker - Add a new UI test in
TestCases.Shared.Teststo verify the placeholder reappears - Provide a HostApp page for the UI test under
TestCases.HostApp
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Core/src/Platform/iOS/PickerExtensions.cs | Clear platformPicker.Text before calling UpdatePickerTitle to allow the placeholder to show |
| src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue30463.cs | Add a UITest to toggle SelectedIndex and verify the title returns |
| src/Controls/tests/TestCases.HostApp/Issues/Issue30463.cs | Introduce a ContentPage with a Picker and Button for UI testing |
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue30463.cs
Outdated
Show resolved
Hide resolved
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue30463.cs
Outdated
Show resolved
Hide resolved
|
@jsuarezruiz I'm currently facing this issue, how likely are we to get this change included in the next few weeks? I'm not sure if you're expected any more changes from @HarishwaranVijayakumar |
|
I am also stuck with this issue for migrating my Xamarin Forms app to MAUI. (Microsoft.Maui.Controls 9.0.90) @HarishwaranVijayakumar will this fix take care of situation where SelectedItem is cleared from View Model while using MVVM? |
|
@mahesh139, Yes this will also work while using MVVM |
|
I'm also waiting on a fix for this - @jsuarezruiz @StephaneDelcroix is there any update? Hoping we can see this one soon 🤞 |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
--- title: ".NET MAUI main-to-inflight-candidate Release Notes" date: 2025-08-08 version: "main-to-inflight-candidate" comparison: "main...inflight/candidate" full_changelog: "main...inflight/candidate" description: "Release notes for .NET MAUI main-to-inflight-candidate, covering 10 commits with enhancements and improvements." --- # .NET MAUI main-to-inflight-candidate Release Notes **Version:** main-to-inflight-candidate **Comparison:** main...inflight/candidate **Generated:** August 08, 2025 **Last Updated:** August 08, 2025 **Latest Commit Range:** 7f99494 **Total Commits:** 10 ## What's Changed This release includes 10 commits with various improvements, bug fixes, and enhancements to the .NET MAUI framework. ### .NET MAUI Product Fixes - Update MauiRecyclerView.cs by @github-actions[bot] in #31050 - Added the GraphicsView base images for Windows and mac platforms by @nivetha-nagalingam in #31018 - Fixed CollectionView does not update layout correctly when ItemsSource changes by @Dhivya-SF4094 in #30978 - Fixes #30953 - Fix duplicate app icon resizing by @jeremy-visionaid in #30920 - Fixed GraphicsView event handlers are triggered even when IsEnabled is set to False by @Dhivya-SF4094 in #30755 - Fixes #30649 - [iOS, Mac] Fix for Picker title is not displayed again when SelectedIndex is set to -1 by @HarishwaranVijayakumar in #30486 - Fixes #31011, #30463 ### Testing - [Testing] Feature matrix UITest Cases for GraphicsView Control by @nivetha-nagalingam in #30781 - [Testing] Feature matrix UITest Cases for HybridWebView Control by @NafeelaNazhir in #30613 ### Housekeeping - [create-pull-request] automated change by @github-actions[bot] in #30890 - [create-pull-request] automated change by @github-actions[bot] in #30700 **Full Changelog**: main...inflight/candidate
…ndex is set to -1 (dotnet#30486) * Fix for Picker title not restoring after deselection on iOS * Modified test * Modified AutomationID * Modified testcase * [tests] Add windows and mac snapshots --------- Co-authored-by: Rui Marinho <me@ruimarinho.net>
…ndex is set to -1 (#30486) * Fix for Picker title not restoring after deselection on iOS * Modified test * Modified AutomationID * Modified testcase * [tests] Add windows and mac snapshots --------- Co-authored-by: Rui Marinho <me@ruimarinho.net>
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Issue Details
Root Cause of the issue
On iOS/macOS, a UITextField (which MauiPicker inherits from) only shows the AttributedPlaceholder when the Text property is null or empty
When SelectedIndex changes from a valid index (like 2) to -1, the Text property still retained the previous selected item's text
Since Text wasn't cleared, the placeholder (picker title) couldn't be displayed, even though UpdatePickerTitle() was being called
Description of Change
Issues Fixed
Fixes #30463
Fixes #31011
Tested the behaviour in the follwing platforms
Output
Beforefix.mov
Afterfix.mov