Skip to content

SelectControl: Fix default options showing the Select placeholder - #85172

Merged
ntsekouras merged 5 commits into
trunkfrom
selectcontrol-fix-default-options-showing-select-placeholder
Oct 20, 2026
Merged

ntsekouras merged 5 commits into
trunkfrom
selectcontrol-fix-default-options-showing-select-placeholder

Conversation

@ntsekouras

Copy link
Copy Markdown
Contributor

What

Follow up of: #85167

After the migration to the @wordpress/ui SelectControl (#84345, #84546), selects with a default option stored as an empty string show the Select placeholder 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:

  1. Block position: Default.
  2. Text shadow (when there are enough presets to render the select): Default.
  3. Template part HTML element: Default based on area (<header>).
  4. PostTemplatePanel / PageTemplate on 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.
  5. Legacy widget: 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 widget means no widget, so it uses null instead, which Base UI renders with its label.

It also adds a development warning to SelectControl when an item has an empty string value, so it doesn't regress again.

Testing Instructions

  1. With a block theme, in the post editor add a Group block. In the block settings open the Position options menu, enable Position and observe the select shows Default. Switch to Sticky and back to Default.
  2. In the site editor open a template with a header, select the Header template part and in the block Settings tab open the Advanced panel. Observe the HTML element select shows Default based on area (<header>).
  3. In Global Styles > Typography, open the text shadow control with enough presets and observe the select shows Default.
  4. With a classic theme, go to Appearance > Widgets, add a Legacy Widget block and observe the select shows Select widget.
  5. Everything should work as before.

Screenshots or screencast

select-default-position-before-after select-default-template-part-before-after

Use of AI Tools

Generated with Opus 5.5 and adjusted/reviewed manually.

@ntsekouras
ntsekouras requested review from a team and Mamaduka October 20, 2026 08:08
@ntsekouras ntsekouras self-assigned this Oct 20, 2026
@ntsekouras ntsekouras added the [Type] Bug An existing feature does not function as intended label Oct 20, 2026
@ntsekouras ntsekouras added the [Feature] UI Components Impacts or related to the UI component system label Oct 20, 2026
@github-actions github-actions Bot added [Package] Editor /packages/editor [Package] Block library /packages/block-library [Package] Block editor /packages/block-editor [Package] UI /packages/ui labels Oct 20, 2026
@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground

🎉 Props

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

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>

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 props-bot label to refresh.

📦 Bundle size

Size Change: +141 B (0%)

Total Size: 8.97 MB

📦 View Changed
Filename Size Change
build/scripts/block-editor/index.min.js 604 kB +70 B (+0.01%)
build/scripts/block-library/index.min.js 442 kB +24 B (+0.01%)
build/scripts/editor/index.min.js 614 kB +42 B (+0.01%)
build/scripts/widgets/index.min.js 70.3 kB +5 B (+0.01%)

77d495c Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric c40fb42 trunk % Change
timeToFirstByte 37.5 ms +2.93% -6.8% 37.6 ms +8.24% -7.71% -0.27%
largestContentfulPaint 66 ms +9.09% -6.06% 64 ms +9.38% -3.13% 3.13%
lcpMinusTtfb 27.6 ms +20.65% -6.16% 26.7 ms +13.67% -3.93% 3.37%
wpBeforeTemplate 19.38 ms +6.66% -5.73% 19.36 ms +16.37% -6.56% 0.1%
wpTemplate 14.04 ms +10.47% -3.92% 13.7 ms +10.36% -2.85% 2.48%
wpTotal 34.23 ms +3.1% -7.16% 34.33 ms +8.48% -7.78% -0.29%
wpMemoryUsage 7.64 MB +0% -0% 7.61 MB +0% -0% 0.46%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric c40fb42 trunk % Change
timeToFirstByte 29.7 ms +21.04% -4.38% 28.5 ms +9.3% -6.14% 4.21%
largestContentfulPaint 66 ms +18.18% -3.03% 64 ms +3.13% -6.25% 3.13%
lcpMinusTtfb 36.05 ms +19.56% -3.33% 34.5 ms +2.9% -1.74% 4.49%
wpBeforeTemplate 17.87 ms +13.71% -2.85% 17.41 ms +10.68% -7.52% 2.64%
wpTemplate 8.89 ms +25.65% -7.99% 8.43 ms +7.35% -10.44% 5.46%
wpTotal 27.05 ms +20.74% -5.36% 25.83 ms +9.72% -6.81% 4.72%
wpMemoryUsage 6.22 MB +0% -0% 6.19 MB +0% -0% 0.58%
wpDbQueries 9 +0% -0% 9 +0% -0% 0%

media-processing

Metric c40fb42 trunk % Change
mediaProcessingJpeg 230.09 ms +9.14% -1.78% 230.5 ms +0.82% -0.41% -0.18%
mediaProcessingAvif 3747.37 ms +1.3% -1.04% 3747.28 ms +1.29% -0.38% 0%
mediaProcessingJpegToAvif 2587.86 ms +1.11% -0.58% 2617.47 ms +0.83% -0.84% -1.13%

media-upload

Metric c40fb42 trunk % Change
jpegUploadProcessing 1423.04 ms +1.01% -0.75% 1407.45 ms +0.4% -0.68% 1.11%
pngUploadProcessing 194.74 ms +6.68% -2.81% 190.98 ms +4.29% -9.01% 1.97%
largeJpegUploadProcessing 1411.42 ms +0.56% -0.75% 1411.83 ms +0.5% -0.46% -0.03%
multipleImageUploadProcessing 1507.9 ms +0.77% -1.22% 1469.35 ms +0.29% -0.11% 2.62%

post-editor

Metric c40fb42 trunk % Change
serverResponse 501.31 ms +4.43% -3.9% 535.05 ms +0.61% -6.63% -6.31%
firstPaint 445.24 ms +17.24% -32.74% 356.34 ms +40.16% -12.64% 24.95%
domContentLoaded 1240.24 ms +1.67% -4.32% 1237.19 ms +1.88% -2.29% 0.25%
loaded 1241.41 ms +1.66% -4.32% 1238.54 ms +1.87% -2.3% 0.23%
firstContentfulPaint 519.65 ms +11.72% -4.07% 522.31 ms +3.43% -4.38% -0.51%
firstBlock 3822.54 ms +3.36% -1.87% 3942.33 ms +0.18% -5.33% -3.04%
type 19.79 ms +1.87% -2.43% 17.72 ms +5.76% -4.57% 11.68%
typeWithoutInspector 18.84 ms +3.13% -4.14% 18.56 ms +0.86% -5.06% 1.51%
typeWithTopToolbar 25.29 ms +7% -2.65% 23.1 ms +10.61% -2.81% 9.48%
typeContainer 9.46 ms +8.88% -7.72% 9.37 ms +11.95% -2.77% 0.96%
focus 127.44 ms +11.32% -1.99% 128.96 ms +4.27% -5.83% -1.18%
firstFocus 250.32 ms +0% -0% 248.18 ms +0% -0% 0.86%
selectAll 618.94 ms +0.01% -2% 616.22 ms +1.36% -1.11% 0.44%
listViewOpen 85.89 ms +14.16% -11.71% 86.7 ms +2.26% -4.64% -0.93%
inserterOpen 44.84 ms +13.78% -3.95% 43.77 ms +8.04% -8.52% 2.44%
inserterHover 12.85 ms +13.85% -6.46% 11.63 ms +8.51% -6.53% 10.49%
inserterSearch 8.19 ms +9.52% -8.18% 8.4 ms +5.6% -8.33% -2.5%
loadPatterns 668.46 ms +2.4% -6.83% 670.68 ms +2.56% -1.5% -0.33%
wpTotal 490.03 ms +4.74% -3.79% 523.73 ms +0.74% -6.62% -6.43%
wpMemoryUsage 14.66 MB +0% -0% 14.63 MB +0% -0% 0.26%
wpDbQueries 54.5 +0.92% -0.92% 55 +0% -1.82% -0.91%

site-editor

Metric c40fb42 trunk % Change
serverResponse 425.97 ms +2.43% -8.54% 401.94 ms +4.87% -6.89% 5.98%
firstPaint 261.86 ms +35.82% -7.49% 249.66 ms +7.05% -5.89% 4.89%
domContentLoaded 1274.71 ms +4.95% -1.67% 1252.61 ms +1.29% -1.65% 1.76%
loaded 1276.12 ms +4.92% -1.67% 1253.67 ms +1.29% -1.63% 1.79%
firstContentfulPaint 533.08 ms +4.34% -4.36% 509.89 ms +3.09% -12.07% 4.55%
firstBlock 4830.82 ms +0.8% -0.51% 4750.09 ms +1.55% -0.61% 1.7%
type 21.44 ms +7.56% -4.94% 21.97 ms +3.1% -2.59% -2.41%
navigate 126.74 ms +8.98% -1.19% 123.94 ms +15.31% -1.5% 2.26%
loadPatterns 1333.48 ms +3.54% -4.14% 1392.52 ms +4.99% -14.14% -4.24%
loadPages 1065.6 ms +7.35% -3.9% 1088.99 ms +7.13% -6.2% -2.15%
wpTotal 415.81 ms +2.38% -8.94% 391.84 ms +5% -7.21% 6.12%
wpMemoryUsage 12.70 MB +0% -0% 12.66 MB +0% -0% 0.29%
wpDbQueries 44 +2.27% -0% 44 +2.27% -0% 0%

77d495c Run

🏁 Flaky tests

Some 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 /test/e2e/specs/editor/various/core-settings.spec.js, passed after 1 failed attempt.
Error: expect(received).toStrictEqual(expected) // deep equality

- Expected  - 1
+ Received  + 1

  Array [
    "rewrite_rules",
-   "SERIALIZED DATA",
+   "",
  ]
    at forEach (/home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/core-settings.spec.js:46:26)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/core-settings.spec.js:43:35
keeps the blocks selected after dropping a multi-selection in /test/e2e/specs/editor/various/draggable-blocks.spec.js, passed after 1 failed attempt.
TypeError: Cannot read properties of null (reading 'y')
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/draggable-blocks.spec.js:824:57
    at dragSelectionBelowLanding (/home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/draggable-blocks.spec.js:823:3)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/draggable-blocks.spec.js:908:3
refuses the drop and uploads nothing in /test/e2e/specs/editor/various/single-file-placeholder-drop.spec.js, passed after 1 failed attempt.
Error: expect(received).toHaveLength(expected)

Expected length: 0
Received length: 1
Received array:  [{"_links": {"about": [{"href": "http://localhost:8889/wp-json/wp/v2/types/attachment"}], "author": [{"embeddable": true, "href": "http://localhost:8889/wp-json/wp/v2/users/1"}], "collection": [{"href": "http://localhost:8889/wp-json/wp/v2/media"}], "curies": [{"href": "https://api.w.org/{rel}", "name": "wp", "templated": true}], "replies": [{"embeddable": true, "href": "http://localhost:8889/wp-json/wp/v2/comments?post=223"}], "self": [{"href": "http://localhost:8889/wp-json/wp/v2/media/223", "targetHints": {"allow": ["GET", "POST", "PUT", "PATCH", "DELETE"]}}], "wp:attached-to": [{"embeddable": true, "href": "http://localhost:8889/wp-json/wp/v2/posts/222", "id": 222, "post_type": "post"}]}, "alt_text": "", "author": 1, "caption": {"rendered": ""}, "class_list": ["post-223", "attachment", "type-attachment", "status-inherit", "hentry", "entry"], "comment_status": "open", "date": "2026-10-20T12:50:53", "date_gmt": "2026-10-20T12:50:53", "description": {"rendered": "<p class=\"attachment\"><a href='http://localhost:8889/wp-content/uploads/2026/10/4435665a-f7c3-4fb1-92ba-e101dc4d1915.png'><img loading=\"lazy\" decoding=\"async\" width=\"10\" height=\"10\" src=\"http://localhost:8889/wp-content/uploads/2026/10/4435665a-f7c3-4fb1-92ba-e101dc4d1915.png\" class=\"attachment-medium size-medium\" alt=\"\" style=\"width:100%;height:100%;max-width:10px;\" /></a></p>
"}, "featured_media": 0, "filename": "4435665a-f7c3-4fb1-92ba-e101dc4d1915.png", "filesize": 80, "guid": {"rendered": "http://localhost:8889/wp-content/uploads/2026/10/4435665a-f7c3-4fb1-92ba-e101dc4d1915.png"}, "id": 223, "link": "http://localhost:8889/?attachment_id=223", "media_details": {"file": "2026/10/4435665a-f7c3-4fb1-92ba-e101dc4d1915.png", "filesize": 80, "height": 10, "image_meta": {"alt": "", "aperture": "0", "camera": "", "caption": "", "copyright": "", "created_timestamp": "0", "credit": "", "focal_length": "0", "iso": "0", "keywords": [], "orientation": "0", "shutter_speed": "0", "title": ""}, "sizes": {}, "width": 10}, "media_type": "image", "meta": [], "mime_type": "image/png", "modified": "2026-10-20T12:50:53", "modified_gmt": "2026-10-20T12:50:53", "ping_status": "closed", "post": 222, "slug": "4435665a-f7c3-4fb1-92ba-e101dc4d1915", "source_url": "http://localhost:8889/wp-content/uploads/2026/10/4435665a-f7c3-4fb1-92ba-e101dc4d1915.png", "status": "inherit", "template": "", "title": {"rendered": "4435665a-f7c3-4fb1-92ba-e101dc4d1915"}, "type": "attachment"}]
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/single-file-placeholder-drop.spec.js:71:45
restores the blocks when a multi-selection drag is canceled in /test/e2e/specs/editor/various/draggable-blocks.spec.js, passed after 1 failed attempt.
TypeError: Cannot read properties of null (reading 'y')
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/draggable-blocks.spec.js:824:57
    at dragSelectionBelowLanding (/home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/draggable-blocks.spec.js:823:3)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/draggable-blocks.spec.js:871:3

77d495c Run

@oandregal

oandregal commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

This sounds like a big enough issue that warrants to be fixed upstream (the wordpress/ui package)? cc @ciampo @mirka

@ciampo ciampo left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread packages/ui/src/form/select-control/dev-warnings.ts
Comment thread packages/editor/src/components/post-template/classic-theme.jsx Outdated
Comment thread packages/editor/src/components/post-template/classic-theme.jsx Outdated
@ntsekouras
ntsekouras force-pushed the selectcontrol-fix-default-options-showing-select-placeholder branch from 83afed7 to 8adb1d3 Compare October 20, 2026 09:49

@mirka mirka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll also work on a migration guide with these findings from all the migrations.

Comment thread packages/ui/src/form/select-control/dev-warnings.ts
Comment thread packages/ui/src/form/select-control/types.ts Outdated
Comment thread packages/ui/src/form/primitives/select/types.ts Outdated
@ntsekouras
ntsekouras force-pushed the selectcontrol-fix-default-options-showing-select-placeholder branch from 8adb1d3 to 3a54888 Compare October 20, 2026 12:31
@ntsekouras ntsekouras added Backport to Gutenberg RC Pull request that needs to be backported to a Gutenberg release candidate (RC) Backport to WP 7.2 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta labels Oct 20, 2026

@ciampo ciampo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@ntsekouras
ntsekouras merged commit 77b8d87 into trunk Oct 20, 2026
125 of 128 checks passed
@ntsekouras
ntsekouras deleted the selectcontrol-fix-default-options-showing-select-placeholder branch October 20, 2026 13:45
@github-actions github-actions Bot added this to the Gutenberg 24.4 milestone Oct 20, 2026
@github-actions github-actions Bot removed the Backport to WP 7.2 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Oct 20, 2026
gutenbergplugin pushed a commit that referenced this pull request Oct 20, 2026
…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>
@github-actions github-actions Bot added the Backported to WP Core Pull request that has been successfully merged into WP Core label Oct 20, 2026
@github-actions

Copy link
Copy Markdown

I just cherry-picked this PR to the wp/7.2 branch to get it included in the next release: 9ac2f99

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backport to Gutenberg RC Pull request that needs to be backported to a Gutenberg release candidate (RC) Backported to WP Core Pull request that has been successfully merged into WP Core [Feature] UI Components Impacts or related to the UI component system [Package] Block editor /packages/block-editor [Package] Block library /packages/block-library [Package] Editor /packages/editor [Package] UI /packages/ui [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants