Experiments: Rebuild the wp-admin Experiments screen on the wp-build routes pattern#77443
Conversation
Co-authored-by: Daniel Richards <daniel.richards@automattic.com>
# Conflicts: # lib/experiments-page.php # packages/e2e-test-utils-playwright/src/request-utils/gutenberg-experiments.ts # packages/edit-site/src/index.js
…/gutenberg into feature/new-experiments-screen
…rl to be available
# Conflicts: # lib/experiments-page.php
Move the Experiments screen off the legacy `initializeExperiments()` bootstrap in `@wordpress/edit-site` and onto the `wp-build` routes pattern used by `connectors-home` and `font-list`, so it plugs into the same page/route registration pipeline as the other wp-admin screens. - Register a new `experiments` page in `wpPlugin.pages` and create `routes/experiments/` (route.ts + stage.tsx + style.scss + types.ts). - Extend the `gutenberg-experiments` setting schema with `title`, `description`, `group`, and `separate_option`/`option_name` per property, so the experiment metadata can be read from the existing `OPTIONS /wp/v2/settings` endpoint instead of being injected via inline script. - Replace `the_gutenberg_experiments()` with the auto-generated `gutenberg_experiments_wp_admin_render_page()` in the admin submenu. - Redirect the legacy `?page=gutenberg-experiments` URL to `?page=experiments-wp-admin` via a hidden submenu + `load-*` hooks, following the same pattern as `edit-site-routes-backwards-compat.php`. - Remove the now-unused experiments-app code from `@wordpress/edit-site`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Relocate the experiments PHP bootstrap and rename the route package so both
match the existing conventions used by connectors, fonts, and guidelines.
- Move `lib/experiments-page.php` to `lib/experimental/experiments/load.php`,
matching the `lib/experimental/{feature}/load.php` layout shared with
`connectors`, `fonts`, and `guidelines`.
- Rename `routes/experiments/` to `routes/experiments-home/` and the package
to `@wordpress/experiments-home-route`, matching the `-home` naming used by
`connectors-home` and `fonts-home` for the root route of a page.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Simplify the screen to only expose a Save action and surface its result via a
snackbar notice, so users get immediate feedback on save success/failure
consistent with how other wp-admin routes report save outcomes.
- Drop the Reset to default button, ConfirmDialog, and related reset state.
The feature was a rarely-needed escape hatch and complicated the UI.
- Call `saveSettings({ throwOnError: true })` and dispatch
`createSuccessNotice`/`createErrorNotice` from `@wordpress/notices` with
`type: 'snackbar'` to report the outcome.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Rework the form so each category is a collapsible card and changes are
persisted immediately, removing the Save step and its notice feedback.
- Group each experiment category as a `layout: { type: 'card' }` entry with
`isCollapsible` and `isOpened: true`, and switch the outer form to
`layout: { type: 'card' }`, so users see each category as a collapsible
section instead of a single flat list.
- Change experiment fields from `Edit: 'checkbox'` to `Edit: 'toggle'`, which
reads as an on/off control closer to how the settings behave.
- Drop the Save button and the snackbar notice: `setSettings` now calls
`saveSettings()` right after `edit()`, so toggling a switch persists the
change immediately and the toggle state itself is sufficient feedback.
Removes the `@wordpress/notices` dependency and related imports.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…sible The card content wrapper uses `overflow: hidden` for the collapse animation, which clips the focus outline of a toggle flush at the top. Add a small padding-top on the first field inside each card so the focus ring renders within the visible area. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…tion Registering an experiment in load.php only exposes it on the Experiments screen; enabling it in the editor requires a matching JS global bridge in editor-settings.php. Note this in the function docblock so future additions do not silently stop at step one. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
I've vide-coded an approach to add an option to I'm not sure whether we need to move that PR forward 🤔 |
# Conflicts: # lib/experiments-page.php # package.json
The new `gutenberg-content-types` experiment was merged from trunk with a verb-prefixed, colon-style label that did not match the noun-only style used by the other entries in the Other group (Color randomizer, Workflow Palette, Extensible Site Editor, Guidelines). Drop the verb prefix and mirror the "under Settings" phrasing used by Guidelines so both entries describe where the feature surfaces. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Update: #77497 added a new experimental setting, so I updated this PR accordingly.
|
|
Some incoming changes to experiment labels in #7753 (not yet merged just a heads up) |
|
Very cool! A small detail; do you think the cards need to be collapsible? It doesn't seem super-useful. |
|
I've fixed all the conflicts again. Is it okay to merge this PR? I think making the menu slug customizable needs further discussion. |
| @@ -0,0 +1,12 @@ | |||
| @use "@wordpress/base-styles/variables" as *; | |||
There was a problem hiding this comment.
Same issue as #77497 (comment).
@wordpress/base-styles is used here without being declared as a dependency for the route. The build failed in #75814, catching that missing dependency,
There was a problem hiding this comment.
This seems like something easy to miss. We should try to find a way to catch this before merges - maybe stylelint? 🤔
There was a problem hiding this comment.
Yes, we are trying to address it via the isolated installation of dependencies - #76195.
I don't know if Stylelint will be able to catch such dependencies.
There was a problem hiding this comment.
Thanks for pointing that out. #77684 should fix the issue.
|
We've been seeing some various performance tests failing via timeout of >1 hour. For example, here's a recent random failing performance test log: The
Performance test results from above also show a big site-editor
|
|
Possible fix merged here: #77725 Seems to be back to normal |
|
I noticed a bug where experiments toggled on and then off were still being output. Fix here: #77728 As an aside, the redesign looks very nice! 🎉 |
|
Thanks everyone for addressing this 🙇♂️ |




What?
Experimental settingspage to leverage wp-build + DataViews/Forms #77429Rebuild the Experiments screen on top of the new
wp-buildroutes pattern, replacing the PHP-based screen.Why?
The number of screens using wp-build is increasing, including Guidelines, Fonts, Connectors, and AI. To keep pace with these developments, the Gutenberg experiment page should also be revamped.
How?
/wp/v2/settingsTesting Instructions
wp-admin/admin.php?page=gutenberg-experiments— you should be redirected to?page=experiments-wp-admin.Screenshots or screencast
Recording.2026-04-17.160949.mp4
Use of AI Tools
This PR was authored with the help of Claude Code (Anthropic). Code, copy and PR description were reviewed by the author.