-
Notifications
You must be signed in to change notification settings - Fork 820
Forms: deprecate outlined and animated form styles. #43366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: update/migrate-form-fields-to-inner-blocks
Are you sure you want to change the base?
Forms: deprecate outlined and animated form styles. #43366
Conversation
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 🔴 Action required: Please add missing changelog entries for the following projects: Use the Jetpack CLI tool to generate changelog entries by running the following command: Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
@@ -103,6 +104,8 @@ function JetpackContactFormEdit( { name, attributes, setAttributes, clientId, cl | |||
const innerRef = useRef(); | |||
const blockProps = useBlockProps( { ref: wrapperRef } ); | |||
const formClassnames = clsx( className, 'jetpack-contact-form' ); | |||
const hasUpdatedFormStyle = useHasDeprecatedFormStyle( clientId ); | |||
console.log( 'hasUpdatedFormStyle', hasUpdatedFormStyle ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this. 😄
// { name: 'animated', label: __( 'Animated', 'jetpack-forms' ) }, | ||
// @deprecated | ||
// { name: 'outlined', label: __( 'Outlined', 'jetpack-forms' ) }, | ||
// @TODO check if this is needed. It was added 2 years ago and never activated. Time to delete associated styles? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's get rid of the "below" style and associated code in another PR.
// @deprecated | ||
// { name: 'animated', label: __( 'Animated', 'jetpack-forms' ) }, | ||
// @deprecated | ||
// { name: 'outlined', label: __( 'Outlined', 'jetpack-forms' ) }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To keep things need we could extricate all styles and code related to the styles and place them in a deprecated folder.
I personally think we can retain the class, so it becomes only a custom class name that the user can still update in the 'advanced' block tools (I think the classnames are already visible there, so I think it already works). Otherwise the user might be making a small unrelated edit to their form (e.g. changing another block or the title of their post), and then find their form styles are changed when saving. I think the only complex thing would be if we introduce other style variations in the future, and then the user ends up mixing |
This is what I originally did. The form looked completely borked. I think it's because when removing the styles from the registration data in index.js, the block state no longer knows if the form has the style or not. And because the style determines the HTML, e.g., it conditionally loads all the notched HTML, everything explodes. I haven't spent much time yet looking around, but I suppose we could detect the styles on the className attributes and load the notched HTML. I'll try that tomorrow. |
In the editor or frontend? I think in the editor we could consider completely removing the On the frontend I think it's this code here - jetpack/projects/packages/forms/src/contact-form/class-contact-form-field.php Lines 1462 to 1478 in be8aad4
|
The editor.
So removing the notched HTML and associated style CSS in the editor should work to achieve this I'm guessing. I'll try that next. We'll leave the frontend as is of course for users that don't update their forms. |
I tried retaining the style classname ( The editor and frontend will continue to look differently until the user removes the classname from the advance panel in the form's block settings. Maybe it's just me, and it's not a problem. 😄 Anyway, here I've removed the styles from the registration object, and removed all editor CSS and HTML related to the animated/outline styles. Kapture.2025-05-05.at.19.38.26.mp4I generally think it's okay, but it might require some nudge in the editor? What do folks think? |
Withdraw that. It is a problem. I think what we're missing with this solution is the issue we were trying to fix in the first place with #43366: if you change the border styles of input blocks, they won't be reflected on the frontend. So I think we're compounding confusion here: we're deprecating the style, keeping the class name around in the editor, but retaining all the bugs. |
I guess we could keep the frontend solution from the other PR to keep borders working, since that wasn't as complex as the editor solution. 🤔 Another addition could be a small notice in the style variations UI explaining that a deprecated style is being used (hopefully there's a inspector controls group for that). The notice could also provide the option to remove the classname through a button. Maybe you're right though, the experience could be too broken to try deprecating these styles. I do think exploring this PR gives a better idea of the trade offs. The situation with these styles is pretty messy, thanks for continuing to look into it! |
That's a good compromise, at least for this PR. I'll update accordingly so folks can compare. Mentioned on the other PR, but a refactor is possible with a few trade offs (label needs a background color to "break" the input border): https://codepen.io/ramonjd/pen/ByyxExd Thanks for the continued feedback! |
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
e805792
to
8c63530
Compare
bc8dbeb
to
28c431d
Compare
Related to #43327
Proposed changes:
Deprecates Outlined and Animated styles (in fact, all styles) and removes them when a legacy form is loaded in the editor.
When a form is opened using this branch, the
is-style-outline
is detectted upon load.Only if you save the editor does the change take place on the frontend.
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions: