Repository navigation
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 🤖 🔴 Action required: We would recommend that you add a section to the PR description to specify whether this PR includes any changes to data or privacy, like so: 🔴 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! 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 SummaryNo summary data is available for parent commit e9c1ade8, so cannot calculate coverage changes. 😴 If that commit is a feature branch rather than a trunk commit, this is expected. Otherwise, this should be updated once coverage for e9c1ade8 is available. |
💯 this is a very thorny one, thanks for diving deep on it!
This is a good point if we think this winds up being too complex to fix for these styles — I've been trying to think of how it could be possible to dynamically disable the controls. Unfortunately the simple filter for removing support altogether is all or nothing rather than based on conditions, so the following wouldn't work for us: const skipBorders = settings => {
if ( settings.name.indexOf( 'jetpack/input' ) > -1 ) {
if ( settings.supports.__experimentalBorder ) {
delete settings.supports.__experimentalBorder;
}
}
return settings;
};
addFilter( 'blocks.registerBlockType', 'jetpack/contact-form/skip-borders', skipBorders );Something else I'm wondering — it wouldn't be performant, but would it be possible to add a hook to the |
|
While experimenting/researching I found a way to achieve the cut-out in the border using css This might allow us to keep the border applied to the input, but two issues:
|
|
Thanks @talldan and @andrewserong for helping to think about this issue. I took a pretty naive approach first off, but my main objectives were to cause minimum disruption to the users running this style. Now, this is despite the fact that this style — at least in terms of borders — does not work in the first place: on trunk, alternative border styles do not have any effect on radio and checkbox fields in my testing Kapture.2025-05-01.at.07.38.24.mp4So feature parity rather than feature fixing 😄 My impressions while working on this were similar to yours: I'm having serious doubts about the feasibility of this exercise, and I'd expect, with good intentions, we'd be doing users a favor by deprecating outline and possible animated styles.
This is true. 💯 What's also true is that this style is already seriously complicated, and brutally fragile, by which I mean the maintenance burden already exists. I think we'd need to weigh inconvenience to developers against user experience - which should win here? Clearly users of this style should not be in a place where their forms break, but we also shouldn't allow users to dive deeper into a hole (the hole being the outline style) and run the risk of committing to a broken and buggy style.
+1 I would prefer deprecation, I'm just not sure how we should tackle the UX flow. We need to make sure forms on the frontend won't be unaffected until the user edits a post and the form "migrates". That means keeping the current code, or a different version of it around. It will cause confusion if the form in the editor looks radically different to what the user expects. Furthermore, the user might have several outline forms on their site, all of which would have to be migrated separately assuming they need to look the same. I think, in the case of deprecation, we'd have to inform the user of the situation in the editor, that is that editing the page would reset/remove the styles.
Let's say there's a performant way, or @andrewserong's idea above works, we'd still be facing the same conundrum of what to do with existing forms that have border styles. What the UX here? A user would open their post with an outline form and any borders they've applied wouldn't be there? I don't know.
Thanks for following up on this! Do you think it's worth investing time in going down that path? Or would we be replacing the outline feature with another of equal complexity? |
|
Great points @ramonjd!
I think your instincts are right to prioritise the user experience. Of all the options we've discussed so far, the direction of this PR sounds the most promising to me. Deprecating these styles sounds appealing since it'd involve reducing what we maintain, and hiding options for a style we're not sure of how to support also has its appeal. Yet I can't help but feel that in both of those cases we're actively creating a worse UX, and thinking back over my comment from last week, I don't really see how we could meaningfully "switch off" the border controls when the outlined or animated styles are applied 🤔 Whereas with the approach here, within the context of the inner blocks refactor, we're making a best effort to try to maintain compatibility. I think that's a worthy goal, but I do admit it's hard to weigh up! Keen to hear what others think too, and I'll do some more testing of this PR, as well. |
|
For what it's worth, here's the current state of this branch. It's pretty close. Building a form in trunkKapture.2025-05-05.at.11.04.56.mp4Switching to this branchKapture.2025-05-05.at.11.06.13.mp4There are one or two things left to do as you can see in the last video, namely, ensuring that global styles/theme.json presets are applied correctly. I'm working on that now. There is one material improvement: the editor no longer lies to the user by applying border styles to checkbox fields 😄 I reckon we can clean/abstract a few things to reduce the maintenance shock. |
It's the exact reason in my mind why we should choose not to support it and deprecate it. The alternative is to build something complicated on top of something that we admit is already fragile. It compounds the problem. A bad experience for users is one that is fragile and breaks. I'm not saying this PR is broken, but if the code is admittedly complex and built on something fragile, then there's a good chance it'll break in the future. For me, this is particularly the case because of the way this PR is using low level APIs to merge the global style layers. This is an API that WordPress should provide, rather than Jetpack having a custom implementation. I think we should at least discuss what deprecation would look like. I think it could be something like this:
Anyway, if we choose to continue with this PR, I think we need to also not forget that the animated style is also broken, and make sure the solution works for both styles. |
I'm all for deprecation, and would be more than happy to discontinue this PR. Also thanks for outlining the rough steps. Something has to be done about these styles - we're forced into a corner either way if the inner blocks migration is to go ahead. At least in terms of the outline style, it's already half broken so deprecating will be putting it out of its misery.
💯 I think from a user's perspective, deprecating is a breaking change in the editor. That's the main concern I have. I think being upfront about it via a modal message or some other comms trick could mitigate. I can get a deprecate branch started so we can see it in action. |
Same. The other question I have is about scope: but this can go either way — with the inner blocks refactor, how do we minimise how much we're changing at once? Unfortunately both deprecation and ensuring compatibility add complexity to the code change and to what we need to test 😞
Thank you both! In these situations where we're trying to find a balance or trade-off, having branches to play with should help us figure out which way to go. Or at the very least, it'll help give us options we can point to when we ask other folks to help us decide! |
942e010 to
3317f84
Compare
Given that they've been broken for what seems like forever, I feel better about deprecation. |
|
I've been playing around with refactoring options and I can get something close... https://codepen.io/ramonjd/pen/ByyxExd But even then there'll be differences. For the outline style, the first thing to dump is the |
0f5647c to
d192258
Compare
andrewserong
left a comment
There was a problem hiding this comment.
Just left a couple of tiny PHP nits to please the linter, etc, when we're ready for polishing that side of things.
| import { store as blockEditorStore } from '@wordpress/block-editor'; | ||
| import { useSelect } from '@wordpress/data'; | ||
|
|
||
| export default function useGetInnerBlock( clientId, blockName ) { |
There was a problem hiding this comment.
There's a path to combine this with useSibling, but I left it in case we roll back these changes.
There was a problem hiding this comment.
The latest code seems to be going back to the old approach of setting css values on field blocks, which I'd moved away from, so I'll have a look at if we can remove it.
I think we need to have every field working the same, as otherwise it'll be too challenging to keep up with all the inconsistencies.
There was a problem hiding this comment.
Ah yeah, fair enough. Wasn't thinking. I'll see if they can be added to the options block itself.
There was a problem hiding this comment.
Done in: a153a80
They're doubled up by necessity (on label and options blocks) since the options needs to calculate inner padding. Same as inputs I see. I think my brain was trying to avoid the duplication. I dunno 😄
TODO on Monday: ensure the CSS vars are applied to radio/checkboxes on the frontend. (They're not)
There was a problem hiding this comment.
Same as inputs I see. I think my brain was trying to avoid the duplication.
My thinking is it still ends up being duplication whether on the field or input/options blocks, but at least on the input/options blocks the attributes we need are the ones from the block itself, so it saves a step.
| $is_animated_style = 'animated' === $form_style; | ||
| $fieldset_id = "id='" . esc_attr( "$id-label" ) . "'"; | ||
|
|
||
| if ( $is_animated_style ) { |
There was a problem hiding this comment.
Pretty dodgy. Either this, or add the notched HTML to animated style multi fields in the editor. The less of that the better I guessed.
TODO: test this in trunk-created forms. Might need to gate it for inner block forms only.
| template, | ||
| templateLock: 'all', | ||
| } ); | ||
|
|
There was a problem hiding this comment.
We can roll back this change.
There was a problem hiding this comment.
I'm not so sure. I think everything depends on this change. I don't want to see the whole house of cards come crashing down.
There was a problem hiding this comment.
You're right.
This is hilarious and tragic at the same time. 🤣
Hilaragic
|
|
||
| $css_vars .= "--jetpack--contact-form--left-offset: calc(var(--jetpack--contact-form--input-padding-left, 16px) + {$border_left_size});"; | ||
| $css_vars .= '--jetpack--contact-form--label-left: max(var(--jetpack--contact-form--left-offset), var(--jetpack--contact-form--border-radius));'; | ||
| $css_vars .= "--jetpack--contact-form--field-padding: calc(var(--jetpack--contact-form--label-left) - {$border_left_size});"; |
There was a problem hiding this comment.
This PR simplifies these CSS vars #43469
I'm not convinced they're required for the animated style.
There was a problem hiding this comment.
Good news I think. I think we can remove the variable left padding for the Outlined style when there's lots of radius and border.
We've replicated the behaviour from trunk, but in trunk the indentation only occurs in the editor, and has no effect on the frontend in my testing.
Here's trunk:
| Trunk editor | Trunk frontend |
|---|---|
![]() |
![]() |
| $first_el = $this->getFirstElement( $doc, 'div' ); | ||
| /** | ||
| * If the contact form has the `is-style-outlined` class name, we need to get the second div element. | ||
| * This is because, to achieve the outlined effect, the first div is the wrapper div, and the second div is the field wrapper div. | ||
| */ | ||
| if ( isset( $contact_form_attributes['className'] ) && 'is-style-outlined' === $contact_form_attributes['className'] ) { | ||
| $first_el = $this->getFirstElement( $doc, 'div', 1 ); | ||
| } | ||
| return $first_el; |
There was a problem hiding this comment.
You know your code smells when you have to document the unit tests 😄
5255b49 to
9801aee
Compare
|
In this testing I created 6 forms in trunk, then loaded them unchanged in this branch to compare. The screenshots are all from the frontend. It's mostly good.
Some observations/differences. In the feature branch:
Minor things... Getting close! |
| // We check the left side due to writing direction—this variable is used to offset text. | ||
| // TODO: this should factor in RTL languages. | ||
| if ( style?.borderTopLeftRadius || style?.borderBottomLeftRadius ) { | ||
| return `max( ${ style?.borderTopLeftRadius ?? 0 }, ${ style?.borderBottomLeftRadius ?? 0 } )`; |
There was a problem hiding this comment.
I think it might be better to refactor to individual css vars like this:
--jetpack--contact-form--border-top-left-radius: ${ style?.borderRadius ?? style?.borderTopLeftRadius };
--jetpack--contact-form--border-top-right-radius: ${ style?.borderRadius ?? style?.borderTopRightRadius };
--jetpack--contact-form--border-bottom-right-radius: ${ style?.borderRadius ?? style?.borderBottomRightRadius };
--jetpack--contact-form--border-bottom-left-radius: ${ style?.borderRadius ?? style?.borderBottomLeftRadius };Assuming a single border radius value from the two corners is a shortcut to get it working and not very clear in terms of the naming of the css var. It's something that could cause confusion for devs later, so I think better to be explicit with the naming.
Possibly the same for the border size css var.
However, I might leave it to later for a smaller PR.
…#43327) * first commit * backend mania * Removing dividing two top of label. Can reinstate * fix number conversion * Match legacy form behaviour when deriving px values for CSS vars * color, typography * Adjust clip path to cater for 1px borders * Implement outline style support for form fields by integrating useFormStyleOutlineClassesAndStyles hook across various blocks. Update CSS variables and styles for outlined and animated form styles in the contact form backend and frontend components. * Cannot fix overlap right now * Trying to fix select, options, etc * desperately trying to assign the right values to css vars * get background working * path to syncing options * use lodash for merging * global styles specificity * Remove isSynced from hook and related code * Try only using hook on label * Inject CSS vars for input as well as label so that it can calculate correct padding * Call it a jetpack contact form notch width * Fix overflowing background when a narrow border-width is set * Fix input block placeholders not selectable/visible when outlined style is active * Fix animated style label and input offset * Animated style: fix label and input offset when using distinct border left style in editor * Fix trailing notch background color * Inputs should take border radius styles so they match the notched border. Fix global style derivation for borders * Fix incorrect block names Co-authored-by: Ramon <ramonjd@users.noreply.github.com> * Improve support for split border radii in outlined form style * Remove min width for notch * This commit syncs jetpack/options with jetpack/input * abstract get inner block hook * esc notched attrs * Check $legacy values before assignment * move css vars to inner elems * Apply the background to the notch elements again instead of the input to ensure border aligns with background. Remove the z-index rule so that the input/placeholder is visible and can be edited * Adding padding where there's a border Enhance contact form styles and structure by adding support for animated styles, adjusting border colors, and refining fieldset rendering logic. * Add filler notch element on frontend * Fix flex shrink/grow of notch elements with new filler notch element * Limit padding of inputs to support a wider range of border radii units This helps prevent situations where the calculated padding can end up being a huge number when units like % are used. 100% might make sense for a border radius, but that value used for a padding is huge. Cap the padding at 100px to match trunk's max border radius value. * Ensure dropdowns have same styles for input as other fields, DRY up * Updated rendering logic in the contact form fields to differentiate between outlined and animated styles. Introduced a new helper function to manage outlined style attributes and adjusted CSS to ensure proper styling for outlined fields. Cleaned up related code for clarity and maintainability. * Ensure default padding for outlined styles in inputs * Refactor contact form styles to ensure global styles can override default border and padding settings. Updated class logic for option groups to conditionally apply border styles based on attributes, enhancing flexibility and maintainability. * Account for split border radius when calculating css var on the frontend * Set a max width for any elements using --jetpack--contact-form--notch-width of 100px * Update tests with new shortcode attributes and styles for outline and options * Switch inputs and labels for the outlined and animated style so that label is above input * Remove background on inputs for outlined style, background is being applied to labels instead * Add filler notch element to match editor styles * Add max-width for trailing notch element * Fix border radius css var not picking up single values with a unit * Remove border radius and clip path on inputs for outlined style (border radius is applied on the label, clip path does nothing) * Update tests with new attributes and outline HTML * Default white background in the editor * Ensure the Button variation on the Multiple Choice (Checkbox) block inherits the current color from the option block. * Add background color support for outlined style in contact form inputs and update related tests * Fix outlined border radius for checkbox multiple * Fix css border-radius var calculation * Fix checkbox multiple radius for outlined style * Small tidy up * Enhance outline styles handling in contact form fields by adding form style parameter and refining border radius calculations. Update CSS to include z-index for animated labels. * Apply outlined border radius style to radio fields to match other fields * Remove spaces in inline styles * Select arrow position, default padding for has-background * Padding magic on the options in outlined * Add font size adjustment for legend in outlined contact form style * Fix position of legend and right padding for options * Remove export of constant * Combine is_outlined `if` statements for checkbox multiple * Combine is_outlined `if` statements for radio * Rename useFormStyleOutlineClassesAndStyles to useVariationStyleProperties * Only memoize based on changes to block type when merging global styles * Add documentation to useVariationStyleProperties * Small tidy up, rename a function and add docs * Remove commented out css declarations * Remove dead code. Context is unused. Anywhere. Go look if you don't believe me. --------- Co-authored-by: Daniel Richards <daniel.richards@automattic.com>
…#43327) * first commit * backend mania * Removing dividing two top of label. Can reinstate * fix number conversion * Match legacy form behaviour when deriving px values for CSS vars * color, typography * Adjust clip path to cater for 1px borders * Implement outline style support for form fields by integrating useFormStyleOutlineClassesAndStyles hook across various blocks. Update CSS variables and styles for outlined and animated form styles in the contact form backend and frontend components. * Cannot fix overlap right now * Trying to fix select, options, etc * desperately trying to assign the right values to css vars * get background working * path to syncing options * use lodash for merging * global styles specificity * Remove isSynced from hook and related code * Try only using hook on label * Inject CSS vars for input as well as label so that it can calculate correct padding * Call it a jetpack contact form notch width * Fix overflowing background when a narrow border-width is set * Fix input block placeholders not selectable/visible when outlined style is active * Fix animated style label and input offset * Animated style: fix label and input offset when using distinct border left style in editor * Fix trailing notch background color * Inputs should take border radius styles so they match the notched border. Fix global style derivation for borders * Fix incorrect block names Co-authored-by: Ramon <ramonjd@users.noreply.github.com> * Improve support for split border radii in outlined form style * Remove min width for notch * This commit syncs jetpack/options with jetpack/input * abstract get inner block hook * esc notched attrs * Check $legacy values before assignment * move css vars to inner elems * Apply the background to the notch elements again instead of the input to ensure border aligns with background. Remove the z-index rule so that the input/placeholder is visible and can be edited * Adding padding where there's a border Enhance contact form styles and structure by adding support for animated styles, adjusting border colors, and refining fieldset rendering logic. * Add filler notch element on frontend * Fix flex shrink/grow of notch elements with new filler notch element * Limit padding of inputs to support a wider range of border radii units This helps prevent situations where the calculated padding can end up being a huge number when units like % are used. 100% might make sense for a border radius, but that value used for a padding is huge. Cap the padding at 100px to match trunk's max border radius value. * Ensure dropdowns have same styles for input as other fields, DRY up * Updated rendering logic in the contact form fields to differentiate between outlined and animated styles. Introduced a new helper function to manage outlined style attributes and adjusted CSS to ensure proper styling for outlined fields. Cleaned up related code for clarity and maintainability. * Ensure default padding for outlined styles in inputs * Refactor contact form styles to ensure global styles can override default border and padding settings. Updated class logic for option groups to conditionally apply border styles based on attributes, enhancing flexibility and maintainability. * Account for split border radius when calculating css var on the frontend * Set a max width for any elements using --jetpack--contact-form--notch-width of 100px * Update tests with new shortcode attributes and styles for outline and options * Switch inputs and labels for the outlined and animated style so that label is above input * Remove background on inputs for outlined style, background is being applied to labels instead * Add filler notch element to match editor styles * Add max-width for trailing notch element * Fix border radius css var not picking up single values with a unit * Remove border radius and clip path on inputs for outlined style (border radius is applied on the label, clip path does nothing) * Update tests with new attributes and outline HTML * Default white background in the editor * Ensure the Button variation on the Multiple Choice (Checkbox) block inherits the current color from the option block. * Add background color support for outlined style in contact form inputs and update related tests * Fix outlined border radius for checkbox multiple * Fix css border-radius var calculation * Fix checkbox multiple radius for outlined style * Small tidy up * Enhance outline styles handling in contact form fields by adding form style parameter and refining border radius calculations. Update CSS to include z-index for animated labels. * Apply outlined border radius style to radio fields to match other fields * Remove spaces in inline styles * Select arrow position, default padding for has-background * Padding magic on the options in outlined * Add font size adjustment for legend in outlined contact form style * Fix position of legend and right padding for options * Remove export of constant * Combine is_outlined `if` statements for checkbox multiple * Combine is_outlined `if` statements for radio * Rename useFormStyleOutlineClassesAndStyles to useVariationStyleProperties * Only memoize based on changes to block type when merging global styles * Add documentation to useVariationStyleProperties * Small tidy up, rename a function and add docs * Remove commented out css declarations * Remove dead code. Context is unused. Anywhere. Go look if you don't believe me. --------- Co-authored-by: Daniel Richards <daniel.richards@automattic.com>
…#43327) * first commit * backend mania * Removing dividing two top of label. Can reinstate * fix number conversion * Match legacy form behaviour when deriving px values for CSS vars * color, typography * Adjust clip path to cater for 1px borders * Implement outline style support for form fields by integrating useFormStyleOutlineClassesAndStyles hook across various blocks. Update CSS variables and styles for outlined and animated form styles in the contact form backend and frontend components. * Cannot fix overlap right now * Trying to fix select, options, etc * desperately trying to assign the right values to css vars * get background working * path to syncing options * use lodash for merging * global styles specificity * Remove isSynced from hook and related code * Try only using hook on label * Inject CSS vars for input as well as label so that it can calculate correct padding * Call it a jetpack contact form notch width * Fix overflowing background when a narrow border-width is set * Fix input block placeholders not selectable/visible when outlined style is active * Fix animated style label and input offset * Animated style: fix label and input offset when using distinct border left style in editor * Fix trailing notch background color * Inputs should take border radius styles so they match the notched border. Fix global style derivation for borders * Fix incorrect block names Co-authored-by: Ramon <ramonjd@users.noreply.github.com> * Improve support for split border radii in outlined form style * Remove min width for notch * This commit syncs jetpack/options with jetpack/input * abstract get inner block hook * esc notched attrs * Check $legacy values before assignment * move css vars to inner elems * Apply the background to the notch elements again instead of the input to ensure border aligns with background. Remove the z-index rule so that the input/placeholder is visible and can be edited * Adding padding where there's a border Enhance contact form styles and structure by adding support for animated styles, adjusting border colors, and refining fieldset rendering logic. * Add filler notch element on frontend * Fix flex shrink/grow of notch elements with new filler notch element * Limit padding of inputs to support a wider range of border radii units This helps prevent situations where the calculated padding can end up being a huge number when units like % are used. 100% might make sense for a border radius, but that value used for a padding is huge. Cap the padding at 100px to match trunk's max border radius value. * Ensure dropdowns have same styles for input as other fields, DRY up * Updated rendering logic in the contact form fields to differentiate between outlined and animated styles. Introduced a new helper function to manage outlined style attributes and adjusted CSS to ensure proper styling for outlined fields. Cleaned up related code for clarity and maintainability. * Ensure default padding for outlined styles in inputs * Refactor contact form styles to ensure global styles can override default border and padding settings. Updated class logic for option groups to conditionally apply border styles based on attributes, enhancing flexibility and maintainability. * Account for split border radius when calculating css var on the frontend * Set a max width for any elements using --jetpack--contact-form--notch-width of 100px * Update tests with new shortcode attributes and styles for outline and options * Switch inputs and labels for the outlined and animated style so that label is above input * Remove background on inputs for outlined style, background is being applied to labels instead * Add filler notch element to match editor styles * Add max-width for trailing notch element * Fix border radius css var not picking up single values with a unit * Remove border radius and clip path on inputs for outlined style (border radius is applied on the label, clip path does nothing) * Update tests with new attributes and outline HTML * Default white background in the editor * Ensure the Button variation on the Multiple Choice (Checkbox) block inherits the current color from the option block. * Add background color support for outlined style in contact form inputs and update related tests * Fix outlined border radius for checkbox multiple * Fix css border-radius var calculation * Fix checkbox multiple radius for outlined style * Small tidy up * Enhance outline styles handling in contact form fields by adding form style parameter and refining border radius calculations. Update CSS to include z-index for animated labels. * Apply outlined border radius style to radio fields to match other fields * Remove spaces in inline styles * Select arrow position, default padding for has-background * Padding magic on the options in outlined * Add font size adjustment for legend in outlined contact form style * Fix position of legend and right padding for options * Remove export of constant * Combine is_outlined `if` statements for checkbox multiple * Combine is_outlined `if` statements for radio * Rename useFormStyleOutlineClassesAndStyles to useVariationStyleProperties * Only memoize based on changes to block type when merging global styles * Add documentation to useVariationStyleProperties * Small tidy up, rename a function and add docs * Remove commented out css declarations * Remove dead code. Context is unused. Anywhere. Go look if you don't believe me. --------- Co-authored-by: Daniel Richards <daniel.richards@automattic.com>
…#43327) * first commit * backend mania * Removing dividing two top of label. Can reinstate * fix number conversion * Match legacy form behaviour when deriving px values for CSS vars * color, typography * Adjust clip path to cater for 1px borders * Implement outline style support for form fields by integrating useFormStyleOutlineClassesAndStyles hook across various blocks. Update CSS variables and styles for outlined and animated form styles in the contact form backend and frontend components. * Cannot fix overlap right now * Trying to fix select, options, etc * desperately trying to assign the right values to css vars * get background working * path to syncing options * use lodash for merging * global styles specificity * Remove isSynced from hook and related code * Try only using hook on label * Inject CSS vars for input as well as label so that it can calculate correct padding * Call it a jetpack contact form notch width * Fix overflowing background when a narrow border-width is set * Fix input block placeholders not selectable/visible when outlined style is active * Fix animated style label and input offset * Animated style: fix label and input offset when using distinct border left style in editor * Fix trailing notch background color * Inputs should take border radius styles so they match the notched border. Fix global style derivation for borders * Fix incorrect block names Co-authored-by: Ramon <ramonjd@users.noreply.github.com> * Improve support for split border radii in outlined form style * Remove min width for notch * This commit syncs jetpack/options with jetpack/input * abstract get inner block hook * esc notched attrs * Check $legacy values before assignment * move css vars to inner elems * Apply the background to the notch elements again instead of the input to ensure border aligns with background. Remove the z-index rule so that the input/placeholder is visible and can be edited * Adding padding where there's a border Enhance contact form styles and structure by adding support for animated styles, adjusting border colors, and refining fieldset rendering logic. * Add filler notch element on frontend * Fix flex shrink/grow of notch elements with new filler notch element * Limit padding of inputs to support a wider range of border radii units This helps prevent situations where the calculated padding can end up being a huge number when units like % are used. 100% might make sense for a border radius, but that value used for a padding is huge. Cap the padding at 100px to match trunk's max border radius value. * Ensure dropdowns have same styles for input as other fields, DRY up * Updated rendering logic in the contact form fields to differentiate between outlined and animated styles. Introduced a new helper function to manage outlined style attributes and adjusted CSS to ensure proper styling for outlined fields. Cleaned up related code for clarity and maintainability. * Ensure default padding for outlined styles in inputs * Refactor contact form styles to ensure global styles can override default border and padding settings. Updated class logic for option groups to conditionally apply border styles based on attributes, enhancing flexibility and maintainability. * Account for split border radius when calculating css var on the frontend * Set a max width for any elements using --jetpack--contact-form--notch-width of 100px * Update tests with new shortcode attributes and styles for outline and options * Switch inputs and labels for the outlined and animated style so that label is above input * Remove background on inputs for outlined style, background is being applied to labels instead * Add filler notch element to match editor styles * Add max-width for trailing notch element * Fix border radius css var not picking up single values with a unit * Remove border radius and clip path on inputs for outlined style (border radius is applied on the label, clip path does nothing) * Update tests with new attributes and outline HTML * Default white background in the editor * Ensure the Button variation on the Multiple Choice (Checkbox) block inherits the current color from the option block. * Add background color support for outlined style in contact form inputs and update related tests * Fix outlined border radius for checkbox multiple * Fix css border-radius var calculation * Fix checkbox multiple radius for outlined style * Small tidy up * Enhance outline styles handling in contact form fields by adding form style parameter and refining border radius calculations. Update CSS to include z-index for animated labels. * Apply outlined border radius style to radio fields to match other fields * Remove spaces in inline styles * Select arrow position, default padding for has-background * Padding magic on the options in outlined * Add font size adjustment for legend in outlined contact form style * Fix position of legend and right padding for options * Remove export of constant * Combine is_outlined `if` statements for checkbox multiple * Combine is_outlined `if` statements for radio * Rename useFormStyleOutlineClassesAndStyles to useVariationStyleProperties * Only memoize based on changes to block type when merging global styles * Add documentation to useVariationStyleProperties * Small tidy up, rename a function and add docs * Remove commented out css declarations * Remove dead code. Context is unused. Anywhere. Go look if you don't believe me. --------- Co-authored-by: Daniel Richards <daniel.richards@automattic.com>
* Add base form field blocks 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. * changelog * Fix issues with style syncing hook: - 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. * Prevent style syncing when blocks are reused in previews * Ensure label is editable after being emptied and placeholder shows * Opt out of block gap spacing for Options block 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. * Migrate form field blocks to use new base blocks 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. * changelog * Fix CSS linting issues * Make select dropdown field's edit component more robust * First pass at updating form variations * Quick clean up of form variations * Pass required block toolbar control through to Option block for checkbox field * Clean up form field and inner block attributes * Remove lodash dependency from dropdown field edit component * Remove remaining lodash uses in new or updated form blocks * Remove TODO as Dropdown fields didn't use option styles * Fix default styling for Consent field option label * Clean up unrequired TODO item * Clean some more TODOs * Restore empty string defaults for input, option, and label blocks * Revert use sync style hook to previous version retaining undo stack fix * Fix typo Co-authored-by: Ramon <ramonjd@users.noreply.github.com> * Update form field style syncing (#43004) * 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> * Fix linting error in editor.scss * Attempt to fix warnings about PhanUndeclaredTypeParameter for WP_Block * Fix linting issue in class-contact-form.php * Forms: Prevent errors when synced attribute context is not available (#43027) * Forms: Fix error thrown in previews for synced form fields * Clean up * Rename the context type stuff * For html_entity_decode, use ENT_COMPAT since we only care about double quotes for the purposes of JSON decoding * Remove is_array and empty check as we now will always have at least one 'class' attribute on the extra_attrs array * Add transforms for new inner blocks based fields * Clean up standalone checkbox inner blocks template * Clean up dropdown field inner blocks template * Add example definitions for field block types * Allow default checked status for standalone option fields * Fix choice field deprecation edge case * Fix handling of required and width attributes for Textarea field. * Fix label block's placeholder fallbacks * Fix form undo redo issues (#43036) * Fix undo stack issue with useFormWrapper * Fix undo stack issue with text area * Fix undo stack issue with duplicated useFormWrapper * Fix undo stack issue with consent field block * Fix undoing after selecting a block variation causing multiple undo steps * Fix comment typos Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> * Remove `required` property from template This is now provided to the child block through context Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> --------- Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> * Forms: Add PHP unit tests for Migrate form fields to inner blocks JETPACK-262 (#43002) * inital commit - exploratory * do_shortcode * Add test_block_attributes_to_shortcode_attributes_with_styles * add more simple tests * remove unnecessary changes * changelog * LINTO! * Adding WP namespaces * test_gutenblock_render_field_checkbox * Add test for trim * Use optionsdata to presume that block_attributes_to_shortcode_attributes has taken place. Let's test that as a unit * Adding classes and styles in attributes. * block_attributes_to_shortcode_attributes tests * text field which has input and label * Phan complains about \DOMNode::getAttribute. Shut it up. * Try to quiet Phan again by passing a WP_Block instance * Attempt to fix a couple of the code coverage warnings * Try to fix namespace again * Try using the full namespace for the covers annotation instead of the relative name --------- Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com> * Clean up TODO as the important style for Outlined form style can not be avoided * Remove extraneous hook dependency * Remove useFormWrapper audit TODO - all fields use it * Remove TODOs already captured by issues * Remove unused ids from consent, checkbox, single choice and multiple choice fields (#43055) * Fix saving and display of dropdown field placeholder * Fix dropdown field placeholder default This commit also updates the dropdown field input's styles to make it easier to click when the placeholder has previously been cleared. * Fix style linting error * Form inner blocks: supplement existing PHP unit tests (#43076) * 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> * Allow default checked status for standalone option fields (#43077) * Fix date picker field incorrect classname (#43059) * 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> * Revert "Remove deprecated covers annotations in line with #42902" This reverts commit 38791a8. Restoring these in case they were in place for coverage requirements. * Forms: move @Covers to class level in PHP unit tests (#43081) * Hoist @cover annotations to class level. * changelog * Fix field block examples (#43096) * 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 * Forms: Fix display of label and option fallback values in transform previews JETPACK-278 (#43100) * Add fallback styles for dropdown block when css vars are not populated (#43101) * Add missed cleaned up label fallback handling * Fix rendering of legend as a label - Ensure block class is added to legend element - Add custom block classes and styles to legend - Tweak default style specificity so global styles can apply * Remove redundant array check to make linter happy. * Clean up dead code in shared JetpackFieldControls * Try to fix metadata in doc comments warning * Try updating PHP test attributes again, to hopefully please the linter * Forms: ensure custom CSS in global styles applies correctly to checkbox and radio wrappers (#43184) * Refactor class attribute handling in Contact_Form_Field - Trimmed type variable to ensure consistent class generation. - Added specific classes for 'checkbox-multiple' and 'radio' types. - Included TODOs for potential improvements and testing. * changelog * Add block styles for checkbox-multiple and radio fields - Registered new block styles for 'jetpack/field-checkbox-multiple' and 'jetpack/field-radio'. - Updated class handling in Contact_Form_Field to ensure proper application of styles. - Adjusted CSS selectors to reflect changes in class structure for button styles. * Enhance class handling for checkbox-multiple and radio fields - Updated Contact_Form_Field to apply block style classes to wrapper divs for checkbox-multiple and radio types. - Introduced a new method to extract block style classes from the class attribute. - Modified tests to validate the addition of block style classes in the rendering process. * Refactor block style registration for checkbox-multiple and radio fields - Consolidated block style registration for 'jetpack/field-checkbox-multiple' and 'jetpack/field-radio' into a single call. - Updated comments to clarify the purpose of style registration and future improvements. - Adjusted class handling in Contact_Form_Field to include new class naming conventions. * Refactor block style application for checkbox-multiple and radio fields - Streamlined the handling of block style classes for 'checkbox-multiple' and 'radio' types in Contact_Form_Field. - Improved code readability by consolidating conditional checks for block style class assignment. - Ensured consistent application of styles to wrapper divs for both field types. * Enhance radio field rendering tests and block style application - Added tests to validate rendering of radio fields with block style classes. - Improved handling of block style classes for radio fields in Contact_Form_Field to ensure consistent application. - Updated assertions in tests to reflect changes in class structure for radio fields. * Remove outdated changelog entry for migrating form fields to inner blocks with multiple wrapper styles * Enhance field wrapper class handling for contact form fields - Introduced 'fieldwrapperclasses' attribute to allow custom wrapper classes for form fields. - Updated rendering logic in Contact_Form_Field to utilize the new attribute for consistent styling. - Refactored tests to validate the addition of 'fieldwrapperclasses' for various field types, ensuring proper application of block styles. * Try fixing a linting issue with the DataProvider --------- Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com> * Add icons for input, label, option, and options blocks (#43270) * Form Global Styles: Update CSS specificity to 0-1-0 for default editor styles (excluding outlined style) (#43125) * Reduce specificity of text area styles to 0-1-0 * Update specificity of option block styles * Fix option input not scaling with font size for single/multiple choice fields * Fix font:inherit rule overriding global styles font family setting by reduce specificity * Add dead code comments * Forms: only apply `wp-` and `is-style-` classes to fields of new inner block types (#43268) * Only apply the block style classes to the field wrapper if the field is one of the new inner block types. * update tests * Refactor get_block_style_classes to return field wrapper classes and simplify class handling * Ensure there's no whitespace in unimgrated fields * Fix missing checkmark for single choice options on frontend (#43301) * Forms: Fix CSS specificity for compatibility with global styles on the frontend (#43299) * Fix consent field label css specificity preventing global typography styles * Fix checkbox/radio option font-weight css specificity preventing global styles * Remove empty line and duplicate classname * Fix mixed spaces/tabs indentation * Fix checkbox/radio input not scaling with font size for single/multiple options fields * Fix indentation * Fix button style multiple choice checkbox not receiving global styles font color due to css specificity * Fix single choice option not receiving text color due to styles not applying to correct element * Reinstate missing color style * Move option block style classnames to parent wrapper on frontend * Make option label font weight inherited from parent block wrapper, add some back compat for default css styles * Fix tests * Move option styles to parent block level element * Forms: remove color gradients block supports (#43427) * Forms: Update gradient property naming in contact form block and tests to ensure consistency * Forms: Update gradient property naming to 'gradients' for consistency in input and option blocks * Fix label typo --------- Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com> * [WIP] Forms: migrate Outlined form style for inner block based fields (#43327) * first commit * backend mania * Removing dividing two top of label. Can reinstate * fix number conversion * Match legacy form behaviour when deriving px values for CSS vars * color, typography * Adjust clip path to cater for 1px borders * Implement outline style support for form fields by integrating useFormStyleOutlineClassesAndStyles hook across various blocks. Update CSS variables and styles for outlined and animated form styles in the contact form backend and frontend components. * Cannot fix overlap right now * Trying to fix select, options, etc * desperately trying to assign the right values to css vars * get background working * path to syncing options * use lodash for merging * global styles specificity * Remove isSynced from hook and related code * Try only using hook on label * Inject CSS vars for input as well as label so that it can calculate correct padding * Call it a jetpack contact form notch width * Fix overflowing background when a narrow border-width is set * Fix input block placeholders not selectable/visible when outlined style is active * Fix animated style label and input offset * Animated style: fix label and input offset when using distinct border left style in editor * Fix trailing notch background color * Inputs should take border radius styles so they match the notched border. Fix global style derivation for borders * Fix incorrect block names Co-authored-by: Ramon <ramonjd@users.noreply.github.com> * Improve support for split border radii in outlined form style * Remove min width for notch * This commit syncs jetpack/options with jetpack/input * abstract get inner block hook * esc notched attrs * Check $legacy values before assignment * move css vars to inner elems * Apply the background to the notch elements again instead of the input to ensure border aligns with background. Remove the z-index rule so that the input/placeholder is visible and can be edited * Adding padding where there's a border Enhance contact form styles and structure by adding support for animated styles, adjusting border colors, and refining fieldset rendering logic. * Add filler notch element on frontend * Fix flex shrink/grow of notch elements with new filler notch element * Limit padding of inputs to support a wider range of border radii units This helps prevent situations where the calculated padding can end up being a huge number when units like % are used. 100% might make sense for a border radius, but that value used for a padding is huge. Cap the padding at 100px to match trunk's max border radius value. * Ensure dropdowns have same styles for input as other fields, DRY up * Updated rendering logic in the contact form fields to differentiate between outlined and animated styles. Introduced a new helper function to manage outlined style attributes and adjusted CSS to ensure proper styling for outlined fields. Cleaned up related code for clarity and maintainability. * Ensure default padding for outlined styles in inputs * Refactor contact form styles to ensure global styles can override default border and padding settings. Updated class logic for option groups to conditionally apply border styles based on attributes, enhancing flexibility and maintainability. * Account for split border radius when calculating css var on the frontend * Set a max width for any elements using --jetpack--contact-form--notch-width of 100px * Update tests with new shortcode attributes and styles for outline and options * Switch inputs and labels for the outlined and animated style so that label is above input * Remove background on inputs for outlined style, background is being applied to labels instead * Add filler notch element to match editor styles * Add max-width for trailing notch element * Fix border radius css var not picking up single values with a unit * Remove border radius and clip path on inputs for outlined style (border radius is applied on the label, clip path does nothing) * Update tests with new attributes and outline HTML * Default white background in the editor * Ensure the Button variation on the Multiple Choice (Checkbox) block inherits the current color from the option block. * Add background color support for outlined style in contact form inputs and update related tests * Fix outlined border radius for checkbox multiple * Fix css border-radius var calculation * Fix checkbox multiple radius for outlined style * Small tidy up * Enhance outline styles handling in contact form fields by adding form style parameter and refining border radius calculations. Update CSS to include z-index for animated labels. * Apply outlined border radius style to radio fields to match other fields * Remove spaces in inline styles * Select arrow position, default padding for has-background * Padding magic on the options in outlined * Add font size adjustment for legend in outlined contact form style * Fix position of legend and right padding for options * Remove export of constant * Combine is_outlined `if` statements for checkbox multiple * Combine is_outlined `if` statements for radio * Rename useFormStyleOutlineClassesAndStyles to useVariationStyleProperties * Only memoize based on changes to block type when merging global styles * Add documentation to useVariationStyleProperties * Small tidy up, rename a function and add docs * Remove commented out css declarations * Remove dead code. Context is unused. Anywhere. Go look if you don't believe me. --------- Co-authored-by: Daniel Richards <daniel.richards@automattic.com> * Add esc_attr calls to render_radio_field (#43488) * Reinstate default padding where there's a border. Add option chaining to innerBlock look up as trunk forms won't have it. * Use correct block name in get_ouline_styles (#43489) * Forms: standardize animated variation style paddings (#43469) * Update padding for animated style * Fix updated function * Rename get_outline_styles * check borderradius * Calculate border widths with all sides via CSS vars * Fix text area top position * Reinstate default (trunk) padding for animated labels etc * Default value of null on border sizes * Remove dupe CSS * JS Doc :success: * Add legacy CSS var as default * Use the `borderwidth` field attribute as the legacy legacy border width value * Explain use of `borderwidth` value * Update projects/packages/forms/src/contact-form/class-contact-form-field.php Use var `$border_width_attribute` * Add bottom width CSS var to backend, and use border sides in the notched CSS * Remove styles that we're overriding * Switch from !empty to isset for legacy borderwidth attribute check * Do empty/zero check on legacy border widths --------- Co-authored-by: Daniel Richards <daniel.richards@automattic.com> * Forms: Fix block instance border color not overriding global styles border color with outlined style active (on the frontend) (#43532) * Allow block instance border color to override global styles border color * Remove extra space in class name * Revert input + option syncing. Bad! * Forms: Fix typography input styles applying to labels when outline style is active (on frontend) (#43534) * Fix rogue typography attributes from input applying to label * Fix bad rebase * Update tests * For classic themes, do not destructure theme config objects that don't exist. * Forms: Fix custom classnames support in inner blocks migration (#43564) * Forms: fix custom class handling in contact form plugin (#43587) * Forms: Enhance class handling in contact form plugin and tests - Updated class handling in `class-contact-form-plugin.php` to filter empty block style classes. - Modified test cases in `Contact_Form_Plugin_Test.php` and `Contact_Form_Test.php` to include additional attributes and ensure proper class wrapping for various field types. - Improved assertions to validate class attributes in rendered output. * Make innerblocks optional. Just for linting * Forms: Fix outline style label font size (#43590) * Fix text input-style field label font size when outlined style is active. * Remove scaling using variable * Fix scaling of multiple option fields when using outlined style * Tidy up styles * Wrap labels * Fix outlined label font size and animation * Fix animation by ensuring top is a valid value * Remove will-change: transform on frontend too. Transform usually does not change. * Forms: fix inconsistent weights in outline style and terms labels (#43545) * Ensure that existing font-weight styles do not override block and global label styles. * Consent weights * Revert options positioning kram * Increase specificity to 0 1 0 for classic themes * Bump specificity of consent label * Bump specificity * Forms: Fix animated style label font scaling (#43615) * Fix animated style label font size in editor * Add span wrapper around label text * Update animated label styles on frontend * Size and animation adjustments for required text * Fix label animating when selected in editor if using the animated form style variation and no placeholder is set * Forms Fix animated label centered positioning (#43635) * Fix animated label vertical centering when using uneven borders in the input * Remove unused cass var * Forms: Remove options text color support (#43612) * Remove text color support for jetpack/options, since frontend does not replicate the markup of the editor and so style parity cannot be achieved * Try to fix tests * Whoops, wrong flag * One more time --------- Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com> * Forms: options block layout tweaks (#43531) * Refactor contact form styles and rendering logic to enhance alignment and maintainability. Update CSS for radio and checkbox options to use consistent alignment, and streamline fieldset and div class attributes by removing unnecessary prefixes. Improve handling of border styles and attributes for outlined forms, ensuring compatibility with global styles. * Try baseline for the options * Revert changes to "fix" option alignment * Revert option alignment v2 * Add classes to tests * Reinstate tweaks for option positioning * Apply wp-block-jetpack-option class in the attribute migration method * Use em instead of rem. Remove unnecessary tweaks * Border support for classic themes * Ensure radio inputs don't warp in classic themes. Update options description * Force opinionated dimensions on the options inputs * wp-block-jetpack-option was not being applied to inner options blocks * Forms: update padding for jetpack options in contact form to conform with trunk (#43634) * consolidate legends * Remove styles that are inconsistent with existing trunk spacing. (frontend) * Remove padding in editor * editor * The feature branch has different markup for .wp-block-jetpack-options so we need to target the fieldset using different selectors * comments * Fix date field label suffix font size for outlined/animated styles * Fix option input color not inherited in editor * Forms: Update border radius and width handling in deprecateFieldStyles function (#43653) * Attempt to fix warnings about PhanUndeclaredTypeParameter for WP_Block * Forms: Update border radius and width handling in deprecateFieldStyles function * Ensure border radius and width are correctly set to 'undefined' only when they are not provided or are null, allowing for proper handling of zero values. * Coerce lineheight to str * REvert - bad rebase * Update class-contact-form-plugin.php My IDE auto formatted this --------- Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com> * Remove duplicated styles * Form: fix default fallbacks for unmigrated forms (#43676) * Outlined multi option backgrounds defaults * Don't concat the label and option styles for consent and single option in unmigrated forms * PHPCS warning - Use statements are not alphabetically sorted (MediaWiki.Classes.UnsortedUseStatements.UnsortedUse * Forms: tame select arrow positioning (#43674) * initial commit - adding extra markup to the select rendering and fixing positioning of labels * uncommenting * Remove default select border * Update select field rendering to include a wrapper div with the correct class structure for improved styling and consistency in tests. * Update contact form styles to inherit text color and adjust z-index for select wrapper elements * Only run `getAttribute` on select wrapper if there is one * Reinstate padding change * phan me * phanos * whitespace * Ensure that animated labels sit above active input elements. * Forms: account for missing placeholder when transforming input fields to select dropdown and fix z-index (#43721) * Enhance select field transformation by adding default placeholder for input block. Update contact form plugin to correctly reference placeholder attribute. Adjust z-index values in CSS for improved label positioning. * Update z-index values in contact form CSS for improved label positioning and remove redundant styles for outlined fields. * Complete CSS comment * Refactor select field transformation to set placeholder attribute directly from attributes. Remove redundant placeholder handling in inner block creation. * Revert createTextFieldInnerBlocks * Revert experiment. Add default placeholder for select in createTextFieldInnerBlocks * Don't mutate the attributes object * Don't spread optional chaining just in case * Update contact form styles to prevent color overrides by global styles. Add 'color: unset !important;' to both editor.scss and grunion.css for consistent input appearance. (#43737) * Fix consent field spacing between checkbox and label (#43743) * Update context types to use kebab casing (#43740) * Forms: Fix required form field validation for options blocks in the inner blocks refactor (#43738) * Update accessible form selectors for single/multiple choice fields (#43760) * Forms: refactor placeholder handling for outlined and styled forms (#43759) * Forms: Refactor placeholder handling in contact form fields * Simplify placeholder logic to ensure consistent rendering of input fields. * Remove unnecessary conditionals for placeholder assignment and improve code clarity. * Forms: Update contact form styles and placeholder handling * Adjusted placeholder logic to ensure it only renders when a value is present, improving input field consistency. * Updated the contact form stylesheet to include a version query string for better cache management. * Commented out specific CSS rules to prevent unintended side effects related to placeholder visibility in outlined and animated label styles. * Remove other :not(:placeholder-shown) styles * Remove multiple changelogs for branches that were never merged to trunk --------- Co-authored-by: Ramon <ramonjd@users.noreply.github.com> Co-authored-by: Daniel Richards <daniel.richards@automattic.com> Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com> Co-authored-by: Ramon <ramonjd@gmail.com>
* Add base form field blocks 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. * changelog * Fix issues with style syncing hook: - 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. * Prevent style syncing when blocks are reused in previews * Ensure label is editable after being emptied and placeholder shows * Opt out of block gap spacing for Options block 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. * Migrate form field blocks to use new base blocks 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. * changelog * Fix CSS linting issues * Make select dropdown field's edit component more robust * First pass at updating form variations * Quick clean up of form variations * Pass required block toolbar control through to Option block for checkbox field * Clean up form field and inner block attributes * Remove lodash dependency from dropdown field edit component * Remove remaining lodash uses in new or updated form blocks * Remove TODO as Dropdown fields didn't use option styles * Fix default styling for Consent field option label * Clean up unrequired TODO item * Clean some more TODOs * Restore empty string defaults for input, option, and label blocks * Revert use sync style hook to previous version retaining undo stack fix * Fix typo Co-authored-by: Ramon <ramonjd@users.noreply.github.com> * Update form field style syncing (#43004) * 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> * Fix linting error in editor.scss * Attempt to fix warnings about PhanUndeclaredTypeParameter for WP_Block * Fix linting issue in class-contact-form.php * Forms: Prevent errors when synced attribute context is not available (#43027) * Forms: Fix error thrown in previews for synced form fields * Clean up * Rename the context type stuff * For html_entity_decode, use ENT_COMPAT since we only care about double quotes for the purposes of JSON decoding * Remove is_array and empty check as we now will always have at least one 'class' attribute on the extra_attrs array * Add transforms for new inner blocks based fields * Clean up standalone checkbox inner blocks template * Clean up dropdown field inner blocks template * Add example definitions for field block types * Allow default checked status for standalone option fields * Fix choice field deprecation edge case * Fix handling of required and width attributes for Textarea field. * Fix label block's placeholder fallbacks * Fix form undo redo issues (#43036) * Fix undo stack issue with useFormWrapper * Fix undo stack issue with text area * Fix undo stack issue with duplicated useFormWrapper * Fix undo stack issue with consent field block * Fix undoing after selecting a block variation causing multiple undo steps * Fix comment typos Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> * Remove `required` property from template This is now provided to the child block through context Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> --------- Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> * Forms: Add PHP unit tests for Migrate form fields to inner blocks JETPACK-262 (#43002) * inital commit - exploratory * do_shortcode * Add test_block_attributes_to_shortcode_attributes_with_styles * add more simple tests * remove unnecessary changes * changelog * LINTO! * Adding WP namespaces * test_gutenblock_render_field_checkbox * Add test for trim * Use optionsdata to presume that block_attributes_to_shortcode_attributes has taken place. Let's test that as a unit * Adding classes and styles in attributes. * block_attributes_to_shortcode_attributes tests * text field which has input and label * Phan complains about \DOMNode::getAttribute. Shut it up. * Try to quiet Phan again by passing a WP_Block instance * Attempt to fix a couple of the code coverage warnings * Try to fix namespace again * Try using the full namespace for the covers annotation instead of the relative name --------- Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com> * Clean up TODO as the important style for Outlined form style can not be avoided * Remove extraneous hook dependency * Remove useFormWrapper audit TODO - all fields use it * Remove TODOs already captured by issues * Remove unused ids from consent, checkbox, single choice and multiple choice fields (#43055) * Fix saving and display of dropdown field placeholder * Fix dropdown field placeholder default This commit also updates the dropdown field input's styles to make it easier to click when the placeholder has previously been cleared. * Fix style linting error * Form inner blocks: supplement existing PHP unit tests (#43076) * 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> * Allow default checked status for standalone option fields (#43077) * Fix date picker field incorrect classname (#43059) * 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> * Revert "Remove deprecated covers annotations in line with #42902" This reverts commit 38791a8. Restoring these in case they were in place for coverage requirements. * Forms: move @Covers to class level in PHP unit tests (#43081) * Hoist @cover annotations to class level. * changelog * Fix field block examples (#43096) * 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 * Forms: Fix display of label and option fallback values in transform previews JETPACK-278 (#43100) * Add fallback styles for dropdown block when css vars are not populated (#43101) * Add missed cleaned up label fallback handling * Fix rendering of legend as a label - Ensure block class is added to legend element - Add custom block classes and styles to legend - Tweak default style specificity so global styles can apply * Remove redundant array check to make linter happy. * Clean up dead code in shared JetpackFieldControls * Try to fix metadata in doc comments warning * Try updating PHP test attributes again, to hopefully please the linter * Forms: ensure custom CSS in global styles applies correctly to checkbox and radio wrappers (#43184) * Refactor class attribute handling in Contact_Form_Field - Trimmed type variable to ensure consistent class generation. - Added specific classes for 'checkbox-multiple' and 'radio' types. - Included TODOs for potential improvements and testing. * changelog * Add block styles for checkbox-multiple and radio fields - Registered new block styles for 'jetpack/field-checkbox-multiple' and 'jetpack/field-radio'. - Updated class handling in Contact_Form_Field to ensure proper application of styles. - Adjusted CSS selectors to reflect changes in class structure for button styles. * Enhance class handling for checkbox-multiple and radio fields - Updated Contact_Form_Field to apply block style classes to wrapper divs for checkbox-multiple and radio types. - Introduced a new method to extract block style classes from the class attribute. - Modified tests to validate the addition of block style classes in the rendering process. * Refactor block style registration for checkbox-multiple and radio fields - Consolidated block style registration for 'jetpack/field-checkbox-multiple' and 'jetpack/field-radio' into a single call. - Updated comments to clarify the purpose of style registration and future improvements. - Adjusted class handling in Contact_Form_Field to include new class naming conventions. * Refactor block style application for checkbox-multiple and radio fields - Streamlined the handling of block style classes for 'checkbox-multiple' and 'radio' types in Contact_Form_Field. - Improved code readability by consolidating conditional checks for block style class assignment. - Ensured consistent application of styles to wrapper divs for both field types. * Enhance radio field rendering tests and block style application - Added tests to validate rendering of radio fields with block style classes. - Improved handling of block style classes for radio fields in Contact_Form_Field to ensure consistent application. - Updated assertions in tests to reflect changes in class structure for radio fields. * Remove outdated changelog entry for migrating form fields to inner blocks with multiple wrapper styles * Enhance field wrapper class handling for contact form fields - Introduced 'fieldwrapperclasses' attribute to allow custom wrapper classes for form fields. - Updated rendering logic in Contact_Form_Field to utilize the new attribute for consistent styling. - Refactored tests to validate the addition of 'fieldwrapperclasses' for various field types, ensuring proper application of block styles. * Try fixing a linting issue with the DataProvider --------- Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com> * Add icons for input, label, option, and options blocks (#43270) * Form Global Styles: Update CSS specificity to 0-1-0 for default editor styles (excluding outlined style) (#43125) * Reduce specificity of text area styles to 0-1-0 * Update specificity of option block styles * Fix option input not scaling with font size for single/multiple choice fields * Fix font:inherit rule overriding global styles font family setting by reduce specificity * Add dead code comments * Forms: only apply `wp-` and `is-style-` classes to fields of new inner block types (#43268) * Only apply the block style classes to the field wrapper if the field is one of the new inner block types. * update tests * Refactor get_block_style_classes to return field wrapper classes and simplify class handling * Ensure there's no whitespace in unimgrated fields * Fix missing checkmark for single choice options on frontend (#43301) * Forms: Fix CSS specificity for compatibility with global styles on the frontend (#43299) * Fix consent field label css specificity preventing global typography styles * Fix checkbox/radio option font-weight css specificity preventing global styles * Remove empty line and duplicate classname * Fix mixed spaces/tabs indentation * Fix checkbox/radio input not scaling with font size for single/multiple options fields * Fix indentation * Fix button style multiple choice checkbox not receiving global styles font color due to css specificity * Fix single choice option not receiving text color due to styles not applying to correct element * Reinstate missing color style * Move option block style classnames to parent wrapper on frontend * Make option label font weight inherited from parent block wrapper, add some back compat for default css styles * Fix tests * Move option styles to parent block level element * Forms: remove color gradients block supports (#43427) * Forms: Update gradient property naming in contact form block and tests to ensure consistency * Forms: Update gradient property naming to 'gradients' for consistency in input and option blocks * Fix label typo --------- Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com> * [WIP] Forms: migrate Outlined form style for inner block based fields (#43327) * first commit * backend mania * Removing dividing two top of label. Can reinstate * fix number conversion * Match legacy form behaviour when deriving px values for CSS vars * color, typography * Adjust clip path to cater for 1px borders * Implement outline style support for form fields by integrating useFormStyleOutlineClassesAndStyles hook across various blocks. Update CSS variables and styles for outlined and animated form styles in the contact form backend and frontend components. * Cannot fix overlap right now * Trying to fix select, options, etc * desperately trying to assign the right values to css vars * get background working * path to syncing options * use lodash for merging * global styles specificity * Remove isSynced from hook and related code * Try only using hook on label * Inject CSS vars for input as well as label so that it can calculate correct padding * Call it a jetpack contact form notch width * Fix overflowing background when a narrow border-width is set * Fix input block placeholders not selectable/visible when outlined style is active * Fix animated style label and input offset * Animated style: fix label and input offset when using distinct border left style in editor * Fix trailing notch background color * Inputs should take border radius styles so they match the notched border. Fix global style derivation for borders * Fix incorrect block names Co-authored-by: Ramon <ramonjd@users.noreply.github.com> * Improve support for split border radii in outlined form style * Remove min width for notch * This commit syncs jetpack/options with jetpack/input * abstract get inner block hook * esc notched attrs * Check $legacy values before assignment * move css vars to inner elems * Apply the background to the notch elements again instead of the input to ensure border aligns with background. Remove the z-index rule so that the input/placeholder is visible and can be edited * Adding padding where there's a border Enhance contact form styles and structure by adding support for animated styles, adjusting border colors, and refining fieldset rendering logic. * Add filler notch element on frontend * Fix flex shrink/grow of notch elements with new filler notch element * Limit padding of inputs to support a wider range of border radii units This helps prevent situations where the calculated padding can end up being a huge number when units like % are used. 100% might make sense for a border radius, but that value used for a padding is huge. Cap the padding at 100px to match trunk's max border radius value. * Ensure dropdowns have same styles for input as other fields, DRY up * Updated rendering logic in the contact form fields to differentiate between outlined and animated styles. Introduced a new helper function to manage outlined style attributes and adjusted CSS to ensure proper styling for outlined fields. Cleaned up related code for clarity and maintainability. * Ensure default padding for outlined styles in inputs * Refactor contact form styles to ensure global styles can override default border and padding settings. Updated class logic for option groups to conditionally apply border styles based on attributes, enhancing flexibility and maintainability. * Account for split border radius when calculating css var on the frontend * Set a max width for any elements using --jetpack--contact-form--notch-width of 100px * Update tests with new shortcode attributes and styles for outline and options * Switch inputs and labels for the outlined and animated style so that label is above input * Remove background on inputs for outlined style, background is being applied to labels instead * Add filler notch element to match editor styles * Add max-width for trailing notch element * Fix border radius css var not picking up single values with a unit * Remove border radius and clip path on inputs for outlined style (border radius is applied on the label, clip path does nothing) * Update tests with new attributes and outline HTML * Default white background in the editor * Ensure the Button variation on the Multiple Choice (Checkbox) block inherits the current color from the option block. * Add background color support for outlined style in contact form inputs and update related tests * Fix outlined border radius for checkbox multiple * Fix css border-radius var calculation * Fix checkbox multiple radius for outlined style * Small tidy up * Enhance outline styles handling in contact form fields by adding form style parameter and refining border radius calculations. Update CSS to include z-index for animated labels. * Apply outlined border radius style to radio fields to match other fields * Remove spaces in inline styles * Select arrow position, default padding for has-background * Padding magic on the options in outlined * Add font size adjustment for legend in outlined contact form style * Fix position of legend and right padding for options * Remove export of constant * Combine is_outlined `if` statements for checkbox multiple * Combine is_outlined `if` statements for radio * Rename useFormStyleOutlineClassesAndStyles to useVariationStyleProperties * Only memoize based on changes to block type when merging global styles * Add documentation to useVariationStyleProperties * Small tidy up, rename a function and add docs * Remove commented out css declarations * Remove dead code. Context is unused. Anywhere. Go look if you don't believe me. --------- Co-authored-by: Daniel Richards <daniel.richards@automattic.com> * Add esc_attr calls to render_radio_field (#43488) * Reinstate default padding where there's a border. Add option chaining to innerBlock look up as trunk forms won't have it. * Use correct block name in get_ouline_styles (#43489) * Forms: standardize animated variation style paddings (#43469) * Update padding for animated style * Fix updated function * Rename get_outline_styles * check borderradius * Calculate border widths with all sides via CSS vars * Fix text area top position * Reinstate default (trunk) padding for animated labels etc * Default value of null on border sizes * Remove dupe CSS * JS Doc :success: * Add legacy CSS var as default * Use the `borderwidth` field attribute as the legacy legacy border width value * Explain use of `borderwidth` value * Update projects/packages/forms/src/contact-form/class-contact-form-field.php Use var `$border_width_attribute` * Add bottom width CSS var to backend, and use border sides in the notched CSS * Remove styles that we're overriding * Switch from !empty to isset for legacy borderwidth attribute check * Do empty/zero check on legacy border widths --------- Co-authored-by: Daniel Richards <daniel.richards@automattic.com> * Forms: Fix block instance border color not overriding global styles border color with outlined style active (on the frontend) (#43532) * Allow block instance border color to override global styles border color * Remove extra space in class name * Revert input + option syncing. Bad! * Forms: Fix typography input styles applying to labels when outline style is active (on frontend) (#43534) * Fix rogue typography attributes from input applying to label * Fix bad rebase * Update tests * For classic themes, do not destructure theme config objects that don't exist. * Forms: Fix custom classnames support in inner blocks migration (#43564) * Forms: fix custom class handling in contact form plugin (#43587) * Forms: Enhance class handling in contact form plugin and tests - Updated class handling in `class-contact-form-plugin.php` to filter empty block style classes. - Modified test cases in `Contact_Form_Plugin_Test.php` and `Contact_Form_Test.php` to include additional attributes and ensure proper class wrapping for various field types. - Improved assertions to validate class attributes in rendered output. * Make innerblocks optional. Just for linting * Forms: Fix outline style label font size (#43590) * Fix text input-style field label font size when outlined style is active. * Remove scaling using variable * Fix scaling of multiple option fields when using outlined style * Tidy up styles * Wrap labels * Fix outlined label font size and animation * Fix animation by ensuring top is a valid value * Remove will-change: transform on frontend too. Transform usually does not change. * Forms: fix inconsistent weights in outline style and terms labels (#43545) * Ensure that existing font-weight styles do not override block and global label styles. * Consent weights * Revert options positioning kram * Increase specificity to 0 1 0 for classic themes * Bump specificity of consent label * Bump specificity * Forms: Fix animated style label font scaling (#43615) * Fix animated style label font size in editor * Add span wrapper around label text * Update animated label styles on frontend * Size and animation adjustments for required text * Fix label animating when selected in editor if using the animated form style variation and no placeholder is set * Forms Fix animated label centered positioning (#43635) * Fix animated label vertical centering when using uneven borders in the input * Remove unused cass var * Forms: Remove options text color support (#43612) * Remove text color support for jetpack/options, since frontend does not replicate the markup of the editor and so style parity cannot be achieved * Try to fix tests * Whoops, wrong flag * One more time --------- Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com> * Forms: options block layout tweaks (#43531) * Refactor contact form styles and rendering logic to enhance alignment and maintainability. Update CSS for radio and checkbox options to use consistent alignment, and streamline fieldset and div class attributes by removing unnecessary prefixes. Improve handling of border styles and attributes for outlined forms, ensuring compatibility with global styles. * Try baseline for the options * Revert changes to "fix" option alignment * Revert option alignment v2 * Add classes to tests * Reinstate tweaks for option positioning * Apply wp-block-jetpack-option class in the attribute migration method * Use em instead of rem. Remove unnecessary tweaks * Border support for classic themes * Ensure radio inputs don't warp in classic themes. Update options description * Force opinionated dimensions on the options inputs * wp-block-jetpack-option was not being applied to inner options blocks * Forms: update padding for jetpack options in contact form to conform with trunk (#43634) * consolidate legends * Remove styles that are inconsistent with existing trunk spacing. (frontend) * Remove padding in editor * editor * The feature branch has different markup for .wp-block-jetpack-options so we need to target the fieldset using different selectors * comments * Fix date field label suffix font size for outlined/animated styles * Fix option input color not inherited in editor * Forms: Update border radius and width handling in deprecateFieldStyles function (#43653) * Attempt to fix warnings about PhanUndeclaredTypeParameter for WP_Block * Forms: Update border radius and width handling in deprecateFieldStyles function * Ensure border radius and width are correctly set to 'undefined' only when they are not provided or are null, allowing for proper handling of zero values. * Coerce lineheight to str * REvert - bad rebase * Update class-contact-form-plugin.php My IDE auto formatted this --------- Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com> * Remove duplicated styles * Form: fix default fallbacks for unmigrated forms (#43676) * Outlined multi option backgrounds defaults * Don't concat the label and option styles for consent and single option in unmigrated forms * PHPCS warning - Use statements are not alphabetically sorted (MediaWiki.Classes.UnsortedUseStatements.UnsortedUse * Forms: tame select arrow positioning (#43674) * initial commit - adding extra markup to the select rendering and fixing positioning of labels * uncommenting * Remove default select border * Update select field rendering to include a wrapper div with the correct class structure for improved styling and consistency in tests. * Update contact form styles to inherit text color and adjust z-index for select wrapper elements * Only run `getAttribute` on select wrapper if there is one * Reinstate padding change * phan me * phanos * whitespace * Ensure that animated labels sit above active input elements. * Forms: account for missing placeholder when transforming input fields to select dropdown and fix z-index (#43721) * Enhance select field transformation by adding default placeholder for input block. Update contact form plugin to correctly reference placeholder attribute. Adjust z-index values in CSS for improved label positioning. * Update z-index values in contact form CSS for improved label positioning and remove redundant styles for outlined fields. * Complete CSS comment * Refactor select field transformation to set placeholder attribute directly from attributes. Remove redundant placeholder handling in inner block creation. * Revert createTextFieldInnerBlocks * Revert experiment. Add default placeholder for select in createTextFieldInnerBlocks * Don't mutate the attributes object * Don't spread optional chaining just in case * Update contact form styles to prevent color overrides by global styles. Add 'color: unset !important;' to both editor.scss and grunion.css for consistent input appearance. (#43737) * Fix consent field spacing between checkbox and label (#43743) * Update context types to use kebab casing (#43740) * Forms: Fix required form field validation for options blocks in the inner blocks refactor (#43738) * Update accessible form selectors for single/multiple choice fields (#43760) * Forms: refactor placeholder handling for outlined and styled forms (#43759) * Forms: Refactor placeholder handling in contact form fields * Simplify placeholder logic to ensure consistent rendering of input fields. * Remove unnecessary conditionals for placeholder assignment and improve code clarity. * Forms: Update contact form styles and placeholder handling * Adjusted placeholder logic to ensure it only renders when a value is present, improving input field consistency. * Updated the contact form stylesheet to include a version query string for better cache management. * Commented out specific CSS rules to prevent unintended side effects related to placeholder visibility in outlined and animated label styles. * Remove other :not(:placeholder-shown) styles * Remove multiple changelogs for branches that were never merged to trunk --------- Co-authored-by: Ramon <ramonjd@users.noreply.github.com> Co-authored-by: Daniel Richards <daniel.richards@automattic.com> Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com> Co-authored-by: Ramon <ramonjd@gmail.com>

















Proposed changes:
Fixes https://github.com/Automattic/jetpack-roadmap/issues/2413
The main thrust of this PR is to ensure that the form style "Outlined" works as expected with inner blocks. See: #42890
The side quest is to fix many of the existing bugs in trunk including, but not exclusive to:
With this branch you can build amazing forms like this!!
This migration PR is the alternative to deprecating the form at #43366
See JETPACK-273
Prior work:
Testing instructions:
There are two objectives to this PR:
Given that, and the many complications and bugs in trunk already, let's not get too picky. The baseline for compatibility is that forms built in trunk shouldn't break when switching to this branch.
Insert a form with lots of fields. Preferably all of them, so let's say at least:
Apply the "outline" style to the form.
For the
jetpack/inputandjetpack/optionsblocks, play around with border and background color styles in:Get funky with large borders and border radii.
In the editor, make sure syncing and sync toggling works (it's a toggle button at the field level)
Check the editor/frontend.
Things should look mostly the same.
Kapture.2025-05-15.at.15.48.35.mp4
In the frontend, (not the editor) open up a few pages forms that you built in trunk previously. They shouldn't be terrible.