Skip to content
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

Forms: fix seperators not aligning consistently #40967

Open
wants to merge 5 commits into
base: trunk
Choose a base branch
from

Conversation

enejb
Copy link
Member

@enejb enejb commented Jan 10, 2025

Fixes #25025

In my testing I wasn't able to identify the issues that were reported in the Issue. but I did notice that the default spectator doesn't match how the design looks when the seperator is not in the form and has the default styles applied to it.

Proposed changes:

  • This PR Fixes how the default sperator appears in the contact form.
  • Now it is a fixes with that is centerd the width is overwritable by the theme if the theme does provide a max-with value.

Before:
image

image

After:

image

image

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

Does this pull request change what data or activity we track or use?

Testing instructions:

  • Apply this PR
  • Insert a form and add a seperator to it.
  • Notice that it looks as expected when you apply different styles to it.
  • Notice that it looks as expected on the front end as well.
  • Notice that it this works across many themes.

@enejb enejb added [Type] Bug When a feature is broken and / or not performing as intended [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. [Package] Forms labels Jan 10, 2025
@enejb enejb requested a review from a team January 10, 2025 19:48
@enejb enejb self-assigned this Jan 10, 2025
Copy link
Contributor

github-actions bot commented Jan 10, 2025

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WordPress.com Simple site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin, and enable the fix/25025-form-seperator branch.

  • To test on Simple, run the following command on your sandbox:

    bin/jetpack-downloader test jetpack fix/25025-form-seperator
    

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions bot added [Block] Contact Form Form block (also see Contact Form label) [Feature] Contact Form [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ labels Jan 10, 2025
Copy link
Contributor

github-actions bot commented Jan 10, 2025

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

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 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Choose a review path based on your changes:
    • A. Team Review: add the "[Status] Needs Team Review" label
      • For most changes, including minor cross-team impacts.
      • Example: Updating a team-specific component or a small change to a shared library.
    • B. Crew Review: add the "[Status] Needs Review" label
      • For significant changes to core functionality.
      • Example: Major updates to a shared library or complex features.
    • C. Both: Start with Team, then request Crew
      • For complex changes or when you need extra confidence.
      • Example: Refactor affecting multiple systems.
  3. Get at least one approval before merging.

Still unsure? Reach out in #jetpack-developers for guidance!


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen semi-continuously (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly. The next release is scheduled for February 4, 2025 (scheduled code freeze on February 4, 2025).

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@simison simison changed the title Fix/25025 form seperator Forms: fix seperators not aligning consistently Jan 14, 2025
@simison
Copy link
Member

simison commented Jan 14, 2025

I'm not able to get the narrow one working, before/after look the same with both Hey theme and Twenty Twenty Five theme:

Screenshot 2025-01-14 at 12 37 54

Problems I see:

  • Two wide dividers
  • More spacing below/above form dividers than outside the form

Anything I'm missing? I'm chaging this style:

image

@enejb
Copy link
Member Author

enejb commented Jan 15, 2025

Thanks for taking a look @simison!

The issue that is currently happening is that I am targeting the .wp-block-separator.is-style-default class which doesn't get applies by default only when you switch between the different settings. I am not sure why that is the case but I assume it is a bug in editor.

I wanted to implement a css selector that worked as a good default but was also easily overwrite able by the theme. The longer the negative selector is the harder it is to be over-writable by the theme.

Since themes usally do the same thing.

I will try to experiment with different selectors to see if a better compremise can be reached.

More spacing below/above form dividers than outside the form.

Currently we apply a gap between the elements that are added to the form. I will try to remove this gap a follow up commit.

@simison simison requested a review from ntsekouras January 16, 2025 14:10
@simison
Copy link
Member

simison commented Jan 16, 2025

@ntsekouras added you as a reviewer in case you know more about how this should work:

[...] the .wp-block-separator.is-style-default class which doesn't get applies by default only when you switch between the different settings. I am not sure why that is the case but I assume it is a bug in editor.

@ntsekouras
Copy link
Member

ntsekouras commented Jan 16, 2025

[...] the .wp-block-separator.is-style-default class which doesn't get applies by default only when you switch between the different settings. I am not sure why that is the case but I assume it is a bug in editor.

That's normal. The default should mean just get the default styles for this block and the other styles should have extra css rules in the block.

I'm not sure for the reason for applying is-style-default after changing, but it shouldn't have any effect. However I think the reason for doing it is that it was easier (or some tech constrain when implemented 🤔 ) to replace the css classes for the block.

@enejb enejb force-pushed the fix/25025-form-seperator branch from 426720a to 3ba4a7d Compare January 21, 2025 22:51
@simison
Copy link
Member

simison commented Jan 22, 2025

@aaronrobertshaw FYI added you as a reviewer just in case you have time to offer insights from your experience!

@aaronrobertshaw
Copy link
Contributor

Thanks for the ping 👍

I've only had the chance for a quick smoke test but this PR seems to achieve its end goal.

I'm not sure for the reason for applying is-style-default after changing, but it shouldn't have any effect.

Agreed. I think if we're aiming to target the default block style (which is really the absence of a block style) we're best served by targeting the block class without the is-style-default.

One other nit is the specificity of the editor style. It would more forward compatible to limit anything that could be styled via global styles, such as margins, to 0-1-0 specificity. Currently, that selector is 0-4-0, which would override anything set in theme.json by a theme author and just generally make overriding styles more difficult which has been a recent pain point with forms.

It might also be of interest to note that just because a block doesn't adopt a block support specifically, that doesn't prevent it from being styled via theme.json. So to the point above, the separator block only opts into top/bottom margins in block supports but it could still technically have left/right margins styled against the block type in theme.json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Contact Form Form block (also see Contact Form label) [Feature] Contact Form [Package] Forms [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Form block: separators don't align consistently
4 participants