Repository navigation
SelectControl: Fix default options showing the Select placeholder - #85172
ntsekouras merged 5 commits into
Conversation
🤖 PR meta 🤖🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Updated as activity occurs, without notifying anyone named here. Add the 📦 Bundle sizeSize Change: +141 B (0%) Total Size: 8.97 MB 📦 View Changed
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. Regression: updating a specific option will only change its value and will not corrupt others in
|
There was a problem hiding this comment.
This sounds like a big enough issue that warrants to be fixed upstream (the wordpress/ui package)? cc @ciampo @mirka
This is not an "issue" or a bug per se, it's just how the component is meant to function, although I understand that it can trip consumers.
I think that the development warning, documentation, and tests in @wordpress/ui are already a good set of changes. At most, we could consider adding a dedicated migration guide that highlights this particular aspect.
The default-to-empty-string conversions should stay in the consumers, preserving their saved values and the shared component's native form serialization.
83afed7 to
8adb1d3
Compare
mirka
left a comment
There was a problem hiding this comment.
I'll also work on a migration guide with these findings from all the migrations.
8adb1d3 to
3a54888
Compare
…85172) Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org> Co-authored-by: ciampo <mciampini@git.wordpress.org> Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: oandregal <oandregal@git.wordpress.org>
|
I just cherry-picked this PR to the wp/7.2 branch to get it included in the next release: 9ac2f99 |
What
Follow up of: #85167
After the migration to the
@wordpress/uiSelectControl(#84345, #84546), selects with a default option stored as an empty string show theSelectplaceholder instead of the option's label when it's selected. Base UI treats an empty string value as no selection.This PR fixes the rest of the affected selects:
Default.Default.Default based on area (<header>).PostTemplatePanel/PageTemplateon classic themes: the default template. Core doesn't render these since Editor: Stabilize the DataForm-based inspector #85081, so this only affects plugins that render them.Select widget.The options that are a choice of their own (1-4) get a non-empty value that is mapped back to
'', so the saved values don't change.Select widgetmeans no widget, so it usesnullinstead, which Base UI renders with its label.It also adds a development warning to
SelectControlwhen an item has an empty stringvalue, so it doesn't regress again.Testing Instructions
Position optionsmenu, enablePositionand observe the select showsDefault. Switch toStickyand back toDefault.Settingstab open theAdvancedpanel. Observe theHTML elementselect showsDefault based on area (<header>).Default.Select widget.Screenshots or screencast
Use of AI Tools
Generated with Opus 5.5 and adjusted/reviewed manually.