Forms: replace the generic block editor welcome modal with a form editor guide - #51039
Forms: replace the generic block editor welcome modal with a form editor guide#51039enejb wants to merge 2 commits into
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Code Coverage SummaryCoverage changed in 1 file.
3 files are newly checked for coverage.
Full summary · PHP report · JS report If appropriate, add one of these labels to override the failing coverage check:
Covered by non-unit tests
|
There was a problem hiding this comment.
Pull request overview
This PR updates the Jetpack Forms custom post type editor (jetpack_form) to replace WordPress’s generic block editor welcome modal with a Forms-specific, 5-step onboarding guide built with @wordpress/components’ Guide. It also suppresses the core welcome modal only while in the form editor, and adds unit tests for the guide visibility predicate.
Changes:
- Add a new Forms “welcome guide” editor plugin (slides, styles, preference storage, and an Options menu entry to open it).
- Add pure visibility/query-arg logic (
should-show.ts) with Jest unit tests. - Suppress/restore core’s welcome guide defaults when entering/leaving the form editor, without persisting changes to
core/edit-postpreferences.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| projects/packages/forms/tests/js/form-editor/welcome-guide/should-show.test.js | Adds unit tests for guide visibility and force-query-arg parsing. |
| projects/packages/forms/src/form-editor/welcome-guide/style.scss | Styles the guide to match core welcome modal sizing and reserve an image slot using logical properties. |
| projects/packages/forms/src/form-editor/welcome-guide/should-show.ts | Implements pure “should show” logic and parsing of jetpack_forms_welcome_guide query arg. |
| projects/packages/forms/src/form-editor/welcome-guide/pages.tsx | Defines the 5 guide pages and a placeholder image slot per slide. |
| projects/packages/forms/src/form-editor/welcome-guide/index.tsx | Implements the editor plugin UI, preference storage, and Options menu item. |
| projects/packages/forms/src/form-editor/index.tsx | Registers/unregisters the welcome guide plugin on enter/leave and suppresses/restores the core welcome modal via setDefaults. |
| projects/packages/forms/changelog/add-forms-editor-welcome-guide | Adds changelog entry describing the new form editor guide. |
| // Tracks closing within this page load. Needed on top of the preference so | ||
| // that a forced guide can still be dismissed. | ||
| const [ isClosed, setIsClosed ] = useState( false ); | ||
|
|
||
| const handleFinish = useCallback( () => { | ||
| setIsClosed( true ); | ||
| set( PREFERENCE_SCOPE, PREFERENCE_NAME, false ); | ||
| }, [ set ] ); | ||
|
|
||
| const handleReopen = useCallback( () => { | ||
| setIsClosed( false ); | ||
| set( PREFERENCE_SCOPE, PREFERENCE_NAME, true ); | ||
| }, [ set ] ); | ||
|
|
||
| const isOpen = ! isClosed && shouldShowWelcomeGuide( { preference, isForced } ); |
| Significance: minor | ||
| Type: added | ||
|
|
||
| Form editor: replace the generic block editor welcome modal with a guide to the form editor. |
…t-run template picker
Proposed changes
The
jetpack_formeditor currently shows the generic block editor welcome modal ("In the WordPress editor, each paragraph, image, or video is presented as a distinct block…"). That copy is accurate but not much help to someone who has just opened the form editor to build a form.This replaces it, in the form editor only, with a five-slide guide covering the form editor's own flow:
Slide copy is drawn from what the editor actually exposes (the categories in
form-categories.ts, the pre-publish panel's settings rows, and the embed modal's three paths) so it doesn't promise anything that isn't there.Artwork is intentionally not included. Each slide reserves a correctly-sized placeholder region, wrapped in an
__imageelement mirroring the core guide's structure, so illustrations can be dropped in later as a straight swap with no layout change.Implementation notes
Guidefrom@wordpress/components— the same component the core welcome modal uses. Sizing mirrors.edit-post-welcome-guide(312px wide, 240px artwork region) so the guide sits at the same scale as the modal it replaces.form-editor/index.tsx, alongside the four plugins already handled there.setDefaults, notset. Defaults are runtime-only and never persisted, so the user's owncore/edit-postpreference is untouched and the generic modal still behaves normally in the post and page editors. A user who has deliberately re-enabled the core guide keeps it, since a persisted preference takes precedence over a default.jetpack/formspreference scope, so it never collides with core's.should-show.tspredicate with unit tests, following the existinginserter-utils.tspattern in this directory.Related product discussion/links
Does this pull request change what data or activity we track or use?
No. The only stored value is a per-user editor preference recording whether the guide has been dismissed.
Testing instructions
Requires a site with Jetpack Forms. The guide can be force-shown on every load with the
jetpack_forms_welcome_guidequery argument, so the first-run experience can be re-tested without resetting preferences.The guide itself
/wp-admin/post-new.php?post_type=jetpack_form&jetpack_forms_welcome_guide=1.Show-once behaviour
/wp-admin/post-new.php?post_type=jetpack_formwith no query argument. The guide should appear.No leakage into the post editor
RTL
Screenshots
Captured on a live Jurassic Ninja site at 1440×900. The grey dashed region on each slide is the reserved artwork placeholder — illustrations are still to come from design.
The guide in context
The five slides