Skip to content

Forms: Add form name modal to wp-build dashboard#47395

Open
enejb wants to merge 2 commits intotrunkfrom
update/form-wp-build-create-form
Open

Forms: Add form name modal to wp-build dashboard#47395
enejb wants to merge 2 commits intotrunkfrom
update/form-wp-build-create-form

Conversation

@enejb
Copy link
Member

@enejb enejb commented Feb 28, 2026

Screen.Recording.2026-02-27.at.4.35.22.PM.mov

Proposed changes

  • When clicking "Create a form" on the wp-build forms dashboard, a modal now prompts the user to name their form before navigating to the editor
  • Added showNameModal prop to CreateFormButton (defaults to false) so the modal only appears in wp-build contexts
  • The useCreateForm hook now accepts an optional formTitle parameter, passed to the editor via post_title URL parameter
  • The editor's FormTitleModal checks for the post_title URL parameter and skips showing the duplicate naming modal when the user already named the form from the dashboard
  • Updated mobile dropdown menu entries in usePageHeaderDetails to also use the form name modal

Other information

All changes are scoped to projects/packages/forms. The modal reuses the existing FormNameModal component.

Does this pull request change what data or activity we track or use?

No

Testing instructions

  1. Enable jetpack_forms_alpha and central form management

  2. Go to the Forms dashboard (wp-build route)

  3. Click "Create a form" — a modal should appear asking for the form name

  4. Enter a name and click "Create" — you should be navigated to the form editor with the title set

  5. Verify the editor's own naming modal does not appear (since you already named the form)

  6. Go back to dashboard, click "Create a form" again, and click "Cancel" — modal should close without navigating

  7. Click "Create a form" and click "Create" without entering a name — the editor should open and show its own naming modal

  8. On mobile, use the dropdown menu's "Create a form" option — same modal behavior

  9. Disable jetpack_forms_alpha / central form management and verify the old dashboard's "Create a form" button still works without showing a modal

When creating a new form from the wp-build forms dashboard, show a modal
prompting the user to name their form before navigating to the editor.
The form title is passed via URL parameter, and the editor's own naming
modal is skipped when a title was already provided from the dashboard.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 28, 2026 00:08
@enejb enejb added the [Status] Needs Review This PR is ready for review. label Feb 28, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 28, 2026

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the update/form-wp-build-create-form branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack update/form-wp-build-create-form

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions
Copy link
Contributor

github-actions bot commented Feb 28, 2026

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

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:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

@github-actions github-actions bot added [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. and removed [Status] Needs Review This PR is ready for review. labels Feb 28, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a “name your form” modal to the wp-build Forms dashboard create flow, passing the chosen name into the editor so the editor-side naming modal can be skipped when appropriate.

Changes:

  • Introduces showNameModal on CreateFormButton (default off) to optionally prompt for a name before creating a form.
  • Extends useCreateForm.openNewForm to accept formTitle and forwards it to wp-admin via post_title query param.
  • Updates the editor’s FormTitleModal to skip prompting when post_title is present, and wires the same naming modal into the mobile actions dropdown.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
projects/packages/forms/src/form-editor/plugins/form-title-modal.tsx Skips editor naming modal when post_title is present in the URL.
projects/packages/forms/src/dashboard/wp-build/hooks/use-page-header-details.tsx Adds mobile “Create a form” modal flow + enables modal for wp-build header buttons.
projects/packages/forms/src/dashboard/hooks/use-create-form.ts Adds optional formTitle to build a post_title URL param.
projects/packages/forms/src/dashboard/components/create-form-button/index.tsx Adds optional naming modal gating the create-form button.
projects/packages/forms/routes/forms/stage.tsx Enables showNameModal for the wp-build “empty state” create button.
projects/packages/forms/changelog/update-form-wp-build-create-form Changelog entry for the new modal behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +63 to +74
const handleModalSave = useCallback(
async ( formName: string ) => {
await openNewForm( {
showPatterns,
formTitle: formName,
analyticsEvent: () => {
jetpackAnalytics.tracks.recordEvent( 'jetpack_wpa_forms_landing_page_cta_click', {
button: 'forms',
} );
},
} ),
} );
},
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

FormNameModal always passes a non-empty name to onSave (it falls back to "Untitled Form" when the input is empty). That means formTitle will always be truthy here, so useCreateForm will always append post_title=..., and the editor’s FormTitleModal will always skip showing—contradicting the intended behavior where submitting an empty name should allow the editor naming modal to appear. Consider updating the flow so an empty input results in no post_title param (e.g., add an option to FormNameModal to allow empty/undefined results, or pass through an empty string and only include post_title when the user actually entered a name).

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

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

No we do want this to be the case otherwise we show the modal twice.

Comment on lines 125 to 127
const hasPostTitle = urlParams.has( 'post_title' );

if ( isFormEditor && ! hasInnerBlocks && isNewForm && ! hasShown && ! hasPostTitle ) {
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

urlParams.has('post_title') treats post_title as present even if it’s empty (e.g. ?post_title=), and it will also skip the modal even when the value is just the default/placeholder. To avoid suppressing the editor naming modal unintentionally, consider using urlParams.get('post_title') and only skipping when the value is non-empty/meaningful.

Suggested change
const hasPostTitle = urlParams.has( 'post_title' );
if ( isFormEditor && ! hasInnerBlocks && isNewForm && ! hasShown && ! hasPostTitle ) {
const postTitle = urlParams.get( 'post_title' );
const hasMeaningfulPostTitle =
typeof postTitle === 'string' && postTitle.trim() !== '';
if (
isFormEditor &&
! hasInnerBlocks &&
isNewForm &&
! hasShown &&
! hasMeaningfulPostTitle
) {

Copilot uses AI. Check for mistakes.
@jp-launch-control
Copy link

jp-launch-control bot commented Feb 28, 2026

Code Coverage Summary

Coverage changed in 4 files.

File Coverage Δ% Δ Uncovered
projects/packages/forms/src/dashboard/components/create-form-button/index.tsx 0/14 (0.00%) 0.00% 9 💔
projects/packages/forms/src/dashboard/wp-build/hooks/use-page-header-details.tsx 0/109 (0.00%) 0.00% 7 💔
projects/packages/forms/src/dashboard/hooks/use-create-form.ts 0/40 (0.00%) 0.00% 3 ❤️‍🩹
projects/packages/forms/src/form-editor/plugins/form-title-modal.tsx 42/43 (97.67%) 0.24% 0 💚

Full summary · PHP report · JS report

If appropriate, add one of these labels to override the failing coverage check: Covered by non-unit tests Use to ignore the Code coverage requirement check when E2Es or other non-unit tests cover the code Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage.

@enejb enejb added [Status] Needs Review This PR is ready for review. and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. labels Feb 28, 2026
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 28, 2026 00:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +99 to +105
async ( formName: string ) => {
const trimmedName = formName.trim();
if ( trimmedName ) {
await openNewForm( { formTitle: trimmedName } );
} else {
await openNewForm( {} );
}
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

handleCreateFormSave has an else branch intended to create a form without a title (so post_title is omitted), but FormNameModal always calls onSave with a non-empty fallback (trimmed input || "Untitled Form"). As a result trimmedName will always be truthy here and the else branch is effectively dead, and the editor’s FormTitleModal will always be skipped.

If you want the “Create with empty name -> show editor naming modal” behavior, FormNameModal needs an option to allow empty/undefined results (or a separate “Skip naming” action). Otherwise, simplify this handler and update the documented/testing expectations accordingly.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants