Repository navigation
CustomSelectControl: Remove unused V2 API and align recommendations - #86663
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. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the 📦 Bundle sizeSize Change: -474 B (-0.01%) Total Size: 8.64 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. Should insert content using the inline inserter in Undo restores the post selection when another synced entity is loaded (RTC WebSocket) in
|
c3f6304 to
e4ddf58
Compare
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain to block approval.
No open issues 🎉
What changed in this PR
Removes the unused internal CustomSelectControlV2 API as part of the select-control migration in #80412, following the FontSizePicker migration in #86661. Public legacy controls remain supported.
Changes:
- Moves the internals needed by legacy
CustomSelectControlinto its own directory and removes V2-only code, types, documentation, and tests. - Aligns Storybook, the component catalog, and lint guidance to recommend WordPress UI select controls.
- Preserves native-select validation and test usages through narrow, documented lint exceptions.
| File | Description |
|---|---|
| tools/docs/manifest.cjs | Removes the deleted V2 README exclusion. |
| storybook/components-manifest.yml | Removes legacy CustomSelectControl from the catalog. |
| packages/eslint-plugin/rules/use-recommended-components.js | Adds UI replacement guidance for both legacy selects. |
| packages/eslint-plugin/docs/rules/use-recommended-components.md | Links migration guides and explains retained exceptions. |
| packages/eslint-plugin/CHANGELOG.md | Records updated select recommendations. |
| packages/dataviews/src/components/validated-form-controls/select-control.tsx | Documents the native-validation lint exception. |
| packages/components/src/custom-select-control/style.module.scss | Retains legacy styling while removing V2-only variants. |
| packages/components/src/custom-select-control/stories/index.story.tsx | Marks the legacy control as not recommended. |
| packages/components/src/custom-select-control/README.md | Recommends UI SelectControl for new interfaces. |
| packages/components/src/custom-select-control/item.tsx | Relocates item internals and removes compact sizing. |
| packages/components/src/custom-select-control/internal-types.ts | Defines types for the retained internal implementation. |
| packages/components/src/custom-select-control/index.tsx | Uses local internals instead of V2 imports. |
| packages/components/src/custom-select-control/custom-select.tsx | Houses the retained legacy select implementation. |
| packages/components/src/custom-select-control-v2/types.ts | Deletes V2-specific types. |
| packages/components/src/custom-select-control-v2/test/index.browser.test.tsx | Deletes tests for the removed V2 API. |
| packages/components/src/custom-select-control-v2/README.md | Deletes V2 documentation. |
| packages/components/src/custom-select-control-v2/index.tsx | Deletes the unused V2 component entry point. |
| packages/components/src/custom-select-control-v2/custom-select.tsx | Removes the former shared implementation after relocation. |
| packages/components/CHANGELOG.md | Records the internal V2 cleanup. |
| packages/block-editor/src/components/responsive-block-control/test/index.jsdom.test.tsx | Documents the native-select test lint exception. |
Review effort: Balanced
e4ddf58 to
ed73cfb
Compare
| 'Use `RadioGroupControl` from `@wordpress/ui` instead. See the migration guide: https://wordpress.github.io/gutenberg/?path=/docs/components-radiocontrol--migration-guide', | ||
| ResponsiveWrapper: 'Use the CSS `aspect-ratio` property instead.', | ||
| SelectControl: | ||
| 'Use `SelectControl` from `@wordpress/ui` instead, or `Select` for the minimal variant. Retain the legacy control when native select behavior is required. See the migration guide: https://wordpress.github.io/gutenberg/?path=/docs/components-selectcontrol--migration-guide', |
There was a problem hiding this comment.
when native select behavior is required
Like what? Was this a thing in any of the migrations?
There was a problem hiding this comment.
I was referring the retained DataViews ValidatedSelectControl, which needs an HTMLSelectElement ref for validation. I've kept that explanation on its import and removed the general caveat from the lint message.
c46c800 to
5729963
Compare
1558d25 to
f418e78
Compare
See #80412. Stacked on #86661.
What?
Remove the unused
CustomSelectControlV2API and recommend the WordPress UI select controls for new interfaces. The public legacy controls remain supported.Why?
V2 has no production consumers or public export. After #86661, the validated wrapper is the only remaining internal
CustomSelectControlconsumer.How?
Move the internals required by v1 under
custom-select-control, remove V2-only rendering and types, and align Storybook, the component catalog, migration guidance, and the recommendation lint rule.Compatibility and retained exceptions
The public v1 export, props, callback shape, legacy class names, and validation behavior remain available. Its existing tests cover the retained implementation; the removed suite exercised the unused V2 API, including multiple selection.
This PR adds no runtime deprecation warning or removal date. The validated custom-select wrapper remains, as do native
SelectControlusages in TimePicker, QueryControls, TreeSelect, and the DataViews validated wrapper. Native-select behavior and validation require separate compatibility decisions.The new lint guidance names the UI alternatives and links to both migration guides. The validated native-select wrapper and a test of a native-select render callback have narrow, explained lint exceptions.
Testing Instructions
SelectControlmigration guide. The UISelectControlshould remain recommended.@wordpress/componentsin a file checked byuse-recommended-components. Check that the lint message names the UI replacement and migration guide.Testing Instructions for Keyboard
In the legacy CustomSelectControl story, use arrow keys while the dropdown is closed, open it, select with Enter, and dismiss with Escape. Check the selected value and focus return against the base branch.
Verification
The retained component, validated wrapper, FontSizePicker, and recommendation-rule suites pass, 199 tests in total. Type checking, CSS lint, the production build, and the Storybook build pass. The generated catalog snapshot removes only CustomSelectControl.
The editor E2E environment could not start because Docker has exhausted its predefined network address pools. No Docker networks were removed.
Use of AI Tools
Implemented and checked with Codex, including an independent agent review.