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

Mailchimp Block: Fix styling issue with FSE #19566

Merged
merged 6 commits into from
Apr 27, 2021

Conversation

stacimc
Copy link
Contributor

@stacimc stacimc commented Apr 19, 2021

Fixes #19481

Changes proposed in this Pull Request:

  • Fix CSS issues with the mailchimp form using the site editor. This PR adds some new base styles for the form in the frontend, mainly adjusting the input width and margins/padding.
  • Also fixes some CSS issues in TT1, including missing margin between form elements

Notes

  • This PR relies on Jetpack Button Block: Ensure block enqueues core Button block styles as a dependency #19595 to fix the button styling. The PRs can be merged in either order, but if you want to see the button styled correctly you must apply this PR on top of that one.
  • This PR does not fix the padding inside the email input; this is because it can't be done in a way that allows themes to override the padding for all input fields. TT1-blocks will need to update this style itself.
  • This is not intended to necessarily match Twenty Twenty One theme styles, just to add some base styles to make the form look presentable on the frontend for now.

Screenshots

Mailchimp block in the footer of a FSE site using TT1 blocks

Before After
Screen Shot 2021-04-19 at 10 09 08 AM Screen Shot 2021-04-21 at 11 47 59 AM

Mailchimp block in the post content of a site using TT1

Before After
Screen Shot 2021-04-19 at 10 09 44 AM Screen Shot 2021-04-21 at 11 47 22 AM

Jetpack product discussion

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

Testing instructions:

Sync this PR; if you would like to see the final styling of the button, you should also apply the #19595 PR.

  • Enable TT1 blocks theme.
  • Insert a mailchimp block in the footer template in the site editor.
  • Confirm that the mailchimp form fields display as expected in the editor.
  • Confirm that the mailchimp form fields display as expected in the front end.
  • Switch to a regular WP theme and insert a mailchimp form block in a post.
  • Confirm that in this post the mailchimp form fields work expected in editor and front end.

@stacimc stacimc added [Type] Bug When a feature is broken and / or not performing as intended [Block] Mailchimp [Focus] FSE Issues related to the site editor / Full Site Editing / FSE feature in Gutenberg labels Apr 19, 2021
@stacimc stacimc self-assigned this Apr 19, 2021
@matticbot
Copy link
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello stacimc! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer and confirm D60371-code works as expected before merging this PR. Once this PR is merged, please commit the changes to WP.com. Thank you!
This revision will be updated with each commit to this PR

@stacimc stacimc requested a review from a team April 19, 2021 17:35
@github-actions github-actions bot added the [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ label Apr 19, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Apr 19, 2021

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.
  • ⚠️ All commits were linted before commit.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ 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 🤖


Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped.
Then, add the "[Status] Needs Team review" label and ask someone from your team review the code.
Once you’ve done so, switch to the "[Status] Needs Review" label; someone from Jetpack Crew will then review this PR and merge it to be included in the next Jetpack release.


Jetpack plugin:

  • Next scheduled release: May 4, 2021.
  • Scheduled code freeze: April 26, 2021.

@stacimc stacimc force-pushed the fix/mailchimp-styling-for-fse branch from 7bef3cf to 5b53683 Compare April 19, 2021 18:39
@andrewserong
Copy link
Member

Unfortunately I haven't been able to get this one to work properly in wpcom. I think it's mostly unrelated to your PR, but on the front end of the site, the Mailchimp block appears to be getting rendered with the components-placeholder wrapper added, which results in a bit of weirdness... along with a white background and black border, the 100% width of the input field causes it to overflow the container, and the button padding isn't getting added.

image

Also, the rendered button has the wp-block-button__link class, but no .components-button class, so the padding and border styling doesn't appear to be targeting it.

I'm not sure if I've done something strange to my testing environment, or if this is particular to wpcom?

margin-bottom: 1em;
}

input {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me visually, but I can see that it's overriding the theme provided styles when using the Barnsbury theme in wpcom. Without the change applied, the theme's CSS targets the input field and sets it to 16px padding:

image

With the change applied, this CSS overrides it and sets the padding to 14px:

image

With this particular theme the difference isn't all that noticeable, but I imagine other themes might diverge a bit more in their padding? That said, I can't quite think how we'd reduce the specificity here to allow the theme styles to override it 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, I'd prefer to not override the themes here. Maybe this particular case is a reasonable one to defer -- remove the styling here and instead ask the block themes to provide a better base style?

Copy link
Member

@andrewserong andrewserong Apr 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point, I notice that the Search block in core also doesn't apply padding by default in TT1-blocks, so maybe it's better to leave it (aside from the width: 100% that you've added).

Search block:

image

Unfortunately I still haven't had much luck investigating the placeholder issue in my environment. I'll try again tomorrow, as I'd like to get to the bottom of what's causing it. Apologies for holding up the review! 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, thank you!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It turns out the weird placeholder issue I encountered occurs only when you view the front end of the site while logged in, with a site that doesn't have a paid plan, and you also have a block on the page that displays an upgrade nudge. I've put together a fix in: #19639

@stacimc
Copy link
Contributor Author

stacimc commented Apr 21, 2021

@andrewserong Hm, I'm not seeing the styling issues you mentioned; maybe a bug with the placeholder class not getting removed correctly after you configured the Mailchimp account?

Also, the rendered button has the wp-block-button__link class, but no .components-button class, so the padding and border styling doesn't appear to be targeting it.

I did notice after rebasing that I'm now seeing wp-block-button__link as opposed to .components-button; I'm not sure what happened there, but in either case I've removed the button styling as your #19595 fixes the button nicely! 😄

andrewserong
andrewserong previously approved these changes Apr 23, 2021
Copy link
Member

@andrewserong andrewserong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this @stacimc! I got to the bottom of the placeholder issue, which will be fixed by #19639.

With that applied, I noticed that the width: 100% still overflows the container slightly in TT1-blocks, so I've pushed a tiny change to add in box-sizing: border-box which gets it playing nicely in that theme.

Before After
image image

This LGTM now! I also tested that the margins look good on the front-end of existing themes. The updated margin looks better to me, less of a gap between the input field and the button 👍

@stacimc stacimc added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. and removed [Status] Needs Team Review labels Apr 23, 2021
kraftbj
kraftbj previously approved these changes Apr 26, 2021
@kraftbj kraftbj added this to the jetpack/9.7 milestone Apr 26, 2021
@kraftbj kraftbj added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Apr 26, 2021
@stacimc stacimc dismissed stale reviews from kraftbj and andrewserong via c645b05 April 26, 2021 23:51
@stacimc stacimc force-pushed the fix/mailchimp-styling-for-fse branch from ea89d19 to c645b05 Compare April 26, 2021 23:51
@stacimc stacimc added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. and removed [Status] Ready to Merge Go ahead, you can push that green button! labels Apr 26, 2021
@stacimc
Copy link
Contributor Author

stacimc commented Apr 26, 2021

Rebased to pass status checks

@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Apr 27, 2021
@jeherve jeherve enabled auto-merge (squash) April 27, 2021 10:38
@jeherve jeherve merged commit 3c02774 into master Apr 27, 2021
@jeherve jeherve deleted the fix/mailchimp-styling-for-fse branch April 27, 2021 10:38
@github-actions
Copy link
Contributor

Great news! One last step: head over to your WordPress.com diff, D60371-code, and commit it.
Once you've done so, come back to this PR and add a comment with your changeset ID.

Thank you!

@github-actions github-actions bot removed the [Status] Ready to Merge Go ahead, you can push that green button! label Apr 27, 2021
@stacimc
Copy link
Contributor Author

stacimc commented May 4, 2021

r225216

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Mailchimp [Focus] FSE Issues related to the site editor / Full Site Editing / FSE feature in Gutenberg [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ Touches WP.com Files [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.

Site Editor Compatibility: Mailchimp Block styling issues in front end
5 participants