Skip to content

Docs: Add SelectControl migration guide - #85220

Merged
mirka merged 4 commits into
trunkfrom
select-control-migration-guide
Oct 22, 2026
Merged

mirka merged 4 commits into
trunkfrom
select-control-migration-guide

Conversation

@mirka

@mirka mirka commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

What?

Add a migration guide from the legacy @wordpress/components SelectControl to @wordpress/ui, attached to the legacy component's Storybook entry and linked from its recommendation notice.

Why?

The recent migrations exposed differences beyond prop names, including empty-string defaults displaying a placeholder, missing initial selections, object callbacks, and portaled popup behavior. Consolidate the guidance from #84345, #84546, #84584, #83035, #84936, and #85172.

A guide specific to CustomSelectControl will be added separately.

How?

Document value identity, callbacks and refs, labels and descriptions, trigger props, grouped native options, minimal controls, overlay integration, and test updates. Recommend one serialization pattern for preserving stored empty strings, distinguish clearable null values and placeholders, and explain form-submission implications. Embed interactive examples, including a controlled empty-string story that displays its stored value.

Testing Instructions

  1. Open SelectControl under Components / @wordpress-components / Selection & Input / Common in Storybook. Follow the migration-guide link in its recommendation notice, or select Migration Guide in the sidebar.
  2. In Preserve an empty string as a real choice, choose Sticky and then Default. Confirm the displayed stored value changes from "sticky" to "", and reopening the popup retains Default. Repeat with the keyboard.
  3. In Provide an option that clears the selection, choose Dark and then Select theme. Confirm the control returns to its empty state. In Show a placeholder before selection, confirm the initial prompt is replaced by the chosen item.
  4. In Migrate minimal controls with Select, change the numeric choice and confirm the trigger updates. Expand its source to inspect the primitive composition.
  5. Confirm the prop table, code examples, section links, and links to the replacement components render correctly.

@mirka mirka added the [Type] Developer Documentation Documentation for developers label Oct 20, 2026
@mirka mirka self-assigned this Oct 20, 2026
@github-actions github-actions Bot added the [Package] Components /packages/components label 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: mirka <0mirka00@git.wordpress.org>
Co-authored-by: ciampo <mciampini@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: 0 B

Total Size: 9.05 MB

d1151bb 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.

Cannot edit the site title as editor in /test/e2e/specs/editor/blocks/site-title.spec.js, passed after 1 failed attempt.
Error: apiRequestContext.fetch: socket hang up
Call log:
  - → POST http://localhost:8889/wp-json/wp/v2/settings
    - user-agent: Playwright/1.63.0 (x64; ubuntu 24.04) node/24.20 CI/1
    - accept: */*
    - accept-encoding: gzip,deflate,br
    - X-WP-Nonce: 425942672d
    - content-type: application/json
    - content-length: 21
    - cookie: wordpress_test_cookie=WP%20Cookie%20check; wordpress_logged_in_23778236db82f19306f247e20a353a99=admin%7C1792832100%7CvtilpMicGaDnRezmtuVifuQprQqn9fld8K8SClM5Me1%7Ca2f7c2059a5695274f6d3796512cb7d151ef52e4fb0accd5c641faaafadbcc1a; wp-settings-time-1=1792659530

    at RequestUtils.rest (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/rest.ts:112:39)
    at RequestUtils.updateSiteSettings (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/site-settings.ts:50:20)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/site-title.spec.js:11:22
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-22T09:02:17", "date_gmt": "2026-10-22T09:02:17", "description": {"rendered": "<p class=\"attachment\"><a href='http://localhost:8889/wp-content/uploads/2026/10/ea329cf7-9846-4cc8-ad7d-d8b72fb31b34.png'><img loading=\"lazy\" decoding=\"async\" width=\"10\" height=\"10\" src=\"http://localhost:8889/wp-content/uploads/2026/10/ea329cf7-9846-4cc8-ad7d-d8b72fb31b34.png\" class=\"attachment-medium size-medium\" alt=\"\" style=\"width:100%;height:100%;max-width:10px;\" /></a></p>
"}, "featured_media": 0, "filename": "ea329cf7-9846-4cc8-ad7d-d8b72fb31b34.png", "filesize": 80, "guid": {"rendered": "http://localhost:8889/wp-content/uploads/2026/10/ea329cf7-9846-4cc8-ad7d-d8b72fb31b34.png"}, "id": 223, "link": "http://localhost:8889/?attachment_id=223", "media_details": {"file": "2026/10/ea329cf7-9846-4cc8-ad7d-d8b72fb31b34.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-22T09:02:17", "modified_gmt": "2026-10-22T09:02:17", "ping_status": "closed", "post": 222, "slug": "ea329cf7-9846-4cc8-ad7d-d8b72fb31b34", "source_url": "http://localhost:8889/wp-content/uploads/2026/10/ea329cf7-9846-4cc8-ad7d-d8b72fb31b34.png", "status": "inherit", "template": "", "title": {"rendered": "ea329cf7-9846-4cc8-ad7d-d8b72fb31b34"}, "type": "attachment"}]
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/single-file-placeholder-drop.spec.js:71:45

d1151bb Run

@github-actions github-actions Bot added the [Package] UI /packages/ui label Oct 22, 2026
@mirka
mirka marked this pull request as ready for review October 22, 2026 09:00
@mirka
mirka requested a review from a team as a code owner October 22, 2026 09:00

@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.

Nice, thank you 🚀

(cc @ntsekouras @oandregal )

@mirka
mirka merged commit dc89086 into trunk Oct 22, 2026
91 of 92 checks passed
@mirka
mirka deleted the select-control-migration-guide branch October 22, 2026 15:04
@github-actions github-actions Bot added this to the Gutenberg 24.4 milestone Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Components /packages/components [Package] UI /packages/ui [Type] Developer Documentation Documentation for developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants