Repository navigation
Forms: migrate form fields to inner blocks - #43765
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
|
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! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryCoverage changed in 8 files. Only the first 5 are listed here.
88 files are newly checked for coverage. Only the first 5 are listed here.
Full summary · PHP report · JS report Coverage check overridden by
Coverage tests to be added later
|
…tions fields to select dropdown (#43789) * Enhance field-select transformation by adding default placeholder for input block if none exists. Update console logs for debugging input attributes in edit.js. Refactor createTextFieldInnerBlocks to ensure non-mutating placeholder assignment during transformation. * Refactor createTextFieldInnerBlocks to avoid mutating input attributes by destructuring them. This ensures a non-mutating approach when transforming to a select field, maintaining the integrity of the original block attributes.
* Fix confusion over label/defaultLabel/placeholder * Remove requiredText prop which does not exist * Change standalone checkbox label placeholder back to Add Label... * Fix variation textarea labels, which were accidentally changed to Message from Other Details
--------- Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Co-authored-by: Ramon <ramonjd@users.noreply.github.com> Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com>
Note: This is the second attempt at this PR, the first attempt was #42890, but was reverted
JETPACK-262
Fixes #42358
Proposed changes:
Does this pull request change what data or activity we track or use?
No changes.
Testing instructions:
General Notes
Goal: Confirm all form field blocks insert and behave as expected.
⸻
Goal: Confirm block and global styles apply and override correctly.
⸻
Goal: Verify how styles are shared across synced fields of similar types.
⸻
Goal: Ensure transforming between field types behaves as expected.
⸻
Goal: Ensure all form patterns insert correctly and render well.
Test inserting:
Verify:
⸻
Goal: Validate style variations and layout combinations.
Insert:
For both, test:
⸻
Goal: Confirm fields can be used within layout blocks.
⸻
Goal: Ensure orphaned fields are auto-wrapped in a Form block.
⸻
Goal: Validate required state control across all field types.
⸻
Goal: Confirm legacy forms upgrade smoothly.
Confirm:
⸻
🧑🦯 Keyboard Accessibility
📱 Mobile Responsiveness
Switch the site language to RTL (e.g., Hebrew, Arabic).
Check that:
♻️ Reusable Blocks
⚙️ Editor Performance
🌍 Multilingual / i18n Support