Skip to content

Conversation

@dhasilva
Copy link
Contributor

Part of FORMS-246

Proposed changes:

This is an experiment for editing the post-submission message in the block editor via a toggle, like the HTML or Markdown blocks do, but editable.
The feature is under an alpha flag and the frontend is not implemented.

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

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

Testing instructions:

  • Enabled the forms_alpha flag
  • Go to the editor and add a form
  • On the toolbar, click on "Submit Preview"

Beware: If you save a form with a custom thank you, the post content is changed and the thank you will be rendered in the frontend even with the flag disabled

Screenshot from 2025-10-22 20-29-12 Screenshot from 2025-10-22 20-29-20

@dhasilva dhasilva requested a review from a team October 23, 2025 00:16
@dhasilva dhasilva self-assigned this Oct 23, 2025
@dhasilva dhasilva added [Status] Needs Review This PR is ready for review. [Type] Task DO NOT MERGE don't merge it! labels Oct 23, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Oct 23, 2025

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 add/forms-custom-thank-you branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack add/forms-custom-thank-you

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

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 a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ 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!

@jp-launch-control
Copy link

jp-launch-control bot commented Oct 23, 2025

Code Coverage Summary

Coverage changed in 2 files.

File Coverage Δ% Δ Uncovered
projects/packages/forms/src/blocks/contact-form/edit.tsx 0/322 (0.00%) 0.00% 54 💔
projects/packages/forms/src/blocks/contact-form/class-contact-form-block.php 396/604 (65.56%) -1.05% 10 💔

6 files are newly checked for coverage. Only the first 5 are listed here.

File Coverage
projects/packages/forms/src/blocks/contact-form/shared/context/form-view-context.ts 0/1 (0.00%) 💔
projects/packages/forms/src/blocks/contact-form/util/is-block-or-descendant.ts 0/11 (0.00%) 💔
projects/packages/forms/src/blocks/form-thank-you/edit.tsx 0/7 (0.00%) 💔
projects/packages/forms/src/blocks/form-thank-you/icon.tsx 0/1 (0.00%) 💔
projects/packages/forms/src/blocks/form-thank-you/index.ts 0/2 (0.00%) 💔

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.

{ __( 'Submit Preview', 'jetpack-forms' ) }
</ToolbarButton>
</ToolbarGroup>
) }
Copy link
Contributor

Choose a reason for hiding this comment

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

Thoughts:

  • Seems promising to me! This kind of toggling seems like the right approach.
  • The basic functionality works in the editor - toggling back and forth, editing the confirmation message.
  • As you noted, the frontend isn't working - it shows both form and confirmation message.
  • "Submit Preview" seems long for the toolbar and not quite right. It would be good to find a single, short word if we're going to have a word. Options might be "Message", "Response", or "Thanks". I do wonder if adding text-base links to the toolbar is scalable though. "Form | Reponse" is already a lot of text.
  • I'm surprised how many distince places we need to add code through the edit.js file for this to work.
    • Mostly separate point - the edit.js for for the form block is getting very long and complicated. We should consider extracting some logic to hooks or something. I find that file hard to follow as is.

@dhasilva dhasilva force-pushed the add/forms-custom-thank-you branch from a65fe61 to 5a2ec31 Compare October 24, 2025 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Contact Form Form block (also see Contact Form label) DO NOT MERGE don't merge it! [Feature] Contact Form [Package] Forms [Status] Needs Review This PR is ready for review. [Type] Task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants