-
Notifications
You must be signed in to change notification settings - Fork 843
Forms: Use Core buttons instead of Jetpack buttons #45007
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
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 3 files.
|
|
Great thing about using core buttons is that they will soon also support pseudo classes like |
be0699e to
04ea827
Compare
|
Rebased |
|
I noticed a couple of things while testing this PR.
Nice work Miguel! |
That was more of a hack. The idea is that you should use one of the stacking blocks, like columns or rows. Since we are using core buttons, we should take advantage of how they interact with those core layout blocks now. |
|
Can we use the core button without its container? Separately, do I remember wrong or does WP templating allow limiting the number of certain type blocks as inner blocks? |
Looks like not: https://github.com/WordPress/gutenberg/blob/trunk/packages/block-library/src/button/block.json#L7 |
CGastrell
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Existing post smoke-test
- Open a post containing a Contact Form created before this patch (uses Jetpack Button)
- Confirm there are no editor errors; publish / update
- View front-end and submit the form – it should behave as it always did
New form
- Insert a fresh Contact Form block
- Verify the submit control is a Core Button in a Core Buttons wrapper
- Publish and submit on the front-end – spinner, disable state and success/error handling should work
❌ Spinner didn't show, neither does disabled state
Variations
- Insert each Contact-Form variation (RSVP, Registration, Feedback, etc.)
- Confirm each uses a Core Button and submits correctly
Editor layout
- Editing experience should respect the different core/block options when saving
👀 Unsure to what extent this means. I can adjust all styling options. Though on Attributes I see this on all opions, and setting "text" messes with the button label:

❌ Changing the URL Attribute makes the button not render on frontend.
👀 Input styles are not shared with the button, should it?
7065a4b to
71ae94b
Compare
|
Added some tests and fixed the class and state binding |
|
Added the same edits to useFormWrapper hook so to use core/buttons |
manzoorwanijk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of suggestions for minor code quality improvements.
projects/packages/forms/src/blocks/contact-form/class-contact-form-block.php
Outdated
Show resolved
Hide resolved
projects/packages/forms/tests/php/contact-form/Contact_Form_Block_Test.php
Outdated
Show resolved
Hide resolved
|
This PR has been marked as stale. This happened because:
If this PR is still useful, please do a [trunk merge or rebase](https://github.com/Automattic/jetpack/blob/trunk/docs/git-workflow.md#keeping-your-branch-up-to-date) and otherwise make sure it's up to date and has clear testing instructions. You may also want to ping possible reviewers in case they've forgotten about it. Please close this PR if you think it's not valid anymore — if you do, please add a brief explanation. If the PR is not updated (or at least commented on) in another month, it will be automatically closed. |
Replaces usage of the custom jetpack/button block with the core/buttons and core/button blocks for submit actions in the contact form. Updates block variations, editor logic, and server-side rendering to support and enhance compatibility with core/buttons, including interactivity attributes and error handling. This change improves alignment with WordPress core blocks and future-proofs the contact form implementation.
Introduces a spinner animation to the submit button when the form is submitting by adding CSS for a loading indicator and keyframes for the spinner effect.
Co-authored-by: Mikael Korpela <mikael@ihminen.org>
Co-authored-by: Mikael Korpela <mikael@ihminen.org>
Co-authored-by: Manzoor Wani <manzoorwani.jk@gmail.com>
…form-block.php Co-authored-by: Manzoor Wani <manzoorwani.jk@gmail.com>
3d4ef8c to
fac10d5
Compare
Resolves FORMS-83
Proposed changes
Buttons → Buttonblock, gaining all improvements made upstream and a more intuitive editing experience.<button type="submit">withjetpack-form-submit-buttonclass).data-wp-class--is-submitting&data-wp-bind--aria-disabledso the Core Button integrates with Jetpack Forms’ submit/disable logic.::afterpseudo-element (no extra markup).wp-block-jetpack-buttonremain intact.Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions
Existing post smoke-test
New form
Variations
Editor layout