-
Notifications
You must be signed in to change notification settings - Fork 820
Forms: Add file upload dropzone block #43114
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: update/migrate-form-fields-to-inner-blocks
Are you sure you want to change the base?
Forms: Add file upload dropzone block #43114
Conversation
Introduces foundational form field blocks: - jetpack/input - jetpack/label - jetpack/option - jetpack/options These blocks will be reused across all field types using inner blocks.
- Prevents adding bulk changes when syncing blocks to the undo stack - Correctly determines the parent field block for option blocks to check if syncing is enabled - Correctly find all option blocks regardless of whether they are a field's direct child, e.g. consent, or nested within an options block e.g. single/multiple choice fields.
This is an enhancement over trunk however the is some work required to make this actually work, especially given the shortcode rendering on the frontend. For the time being this support will explicitly be opted out of. It can be revisited when the benefit justifies the additional complexity and work.
Updates legacy form field blocks to use shared inner blocks: - jetpack/input - jetpack/label - jetpack/option - jetpack/options This commit also updates the registration of form blocks so the new shared blocks are available in the editor.
* Refactor and update form field syncing. - Use a parent react context provider as the source of truth instead of an arbitrary sibling block. - Perform a deep equality check before syncing to prevent against spurious updates. * When updating the block own attributes, mark the change as not persistent so that the user can undo * Prime the previousOwnAttributes value so that we avoid updating syncedAttributes unnecessarily * Update inline docs * Prime the synced attributes when they are initially unset * Fix syncing of styles across checkbox and consent options --------- Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com>
…43027) * Forms: Fix error thrown in previews for synced form fields * Clean up * Rename the context type stuff
…e quotes for the purposes of JSON decoding
…ne 'class' attribute on the extra_attrs array
This commit also updates the dropdown field input's styles to make it easier to click when the placeholder has previously been cleared.
* Enhance unit tests for Contact_Form_Block by adding support checks This commit updates the `test_register_child_blocks` method to include an optional parameter for expected block supports and introduces a new test method, `test_child_blocks_block_supports`, to verify the configuration of block supports for various Jetpack blocks. The data provider for the new test method is also added, ensuring comprehensive testing of block support attributes. * Add unit test for gutenblock_render_field_radio method This commit introduces a new test method, `test_gutenblock_gutenblock_render_field_radio`, to validate the rendering of the radio field block in the Contact Form Plugin. The test checks that the generated shortcode matches the expected output, ensuring proper functionality of the radio field block with various attributes and inner blocks. * changelog * remove duplicate tests. silly me! * Apply suggestions from code review Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> * syncing server block supports with frontend * try again --------- Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com>
* Ensure jetpack-field__input classname applies to date picker input instead of jetpack-field__date * Remove explicit date type in appointment form variation * Specify the field type for the date field in the block template * Iron out inconsistency of date type for date picker inputs * Tied up text fields array --------- Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com>
This reverts commit 38791a8. Restoring these in case they were in place for coverage requirements.
* Hoist @cover annotations to class level. * changelog
* Fix field block examples being altered by useFormWrapper useFormWrapper adds a form wrapper around any field that doesn't have one. It wasn't preserving the field's own inner blocks, which became visible in the block examples, where single or multiple choice fields have inner blocks but no wrapper. This PR ensures the inner blocks are preserved by calling getBlocks to get the inner blocks of the field and passing that as the inner blocks in the replaceBlocks call within useFormWrapper. * Small improvement to variable name * Add missing useEffect deps * Fix select/dropdown example * Switch e2e test close welcome guide code to use preferences
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 🤖 🔴 Action required: Please add missing changelog entries for the following projects: Use the Jetpack CLI tool to generate changelog entries by running the following command: Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
2d6820b
to
3d84a00
Compare
Proposed changes:
TODOs
Editor screenshot:

Other information:
Jetpack product discussion
None.
Does this pull request change what data or activity we track or use?
No.
Testing instructions: