Skip to content

Commit c2f34bf

Browse files
authored
Fix Jetpack contact form spacing (#2174)
1 parent af0d577 commit c2f34bf

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

.changeset/dull-squids-listen.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@cloudfour/patterns': patch
3+
---
4+
5+
Fix issue where Jetpack contact forms could have extra spacing

src/vendor/wordpress/demo/contact-form/form.twig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
{# Markup generated in a local WordPress instance with Jetpack 1.19 on March 14, 2023 #}
66
<div data-test="contact-form" id="contact-form-test" class="wp-block-jetpack-contact-form-container " style="--jetpack--contact-form--primary-color: rgb(61, 132, 245); --jetpack--contact-form--background-color: rgb(255, 255, 255); --jetpack--contact-form--text-color: rgb(0, 0, 0); --jetpack--contact-form--border: 2px inset rgb(227, 227, 227); --jetpack--contact-form--border-color: rgb(227, 227, 227); --jetpack--contact-form--border-size: 2px; --jetpack--contact-form--border-style: inset; --jetpack--contact-form--border-radius: 0px; --jetpack--contact-form--input-background: rgb(255, 255, 255); --jetpack--contact-form--input-padding: 1px 2px; --jetpack--contact-form--input-padding-top: 1px; --jetpack--contact-form--input-padding-left: 2px; --jetpack--contact-form--font-size: 13.3333px; --jetpack--contact-form--font-family: -apple-system; --jetpack--contact-form--line-height: normal;">
77
<form action="#contact-form-test" method="post" class="contact-form commentsblock wp-block-jetpack-contact-form">
8+
{#
9+
Storybook won't preserve an inline script here, but sometimes the
10+
contact form has one, so we're going to insert a div instead to test
11+
that the nested `wp-block-jetpack-contact-form` elements don't have
12+
unnecessary spacing.
13+
#}
14+
<div></div>
815
<div class="wp-block-jetpack-contact-form is-style-default" style="padding-top:16px;padding-right:16px;padding-bottom:16px;padding-left:16px">
916
<div class="grunion-field-name-wrap grunion-field-wrap">
1017
<label for="gtest-name" class="grunion-field-label name">Name<span>(required)</span></label>

src/vendor/wordpress/styles/_jetpack-blocks.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@
2121
padding: 0 !important;
2222
}
2323

24+
/// For some reason the Jetpack contact form sometimes applies the same class
25+
/// to an immediate child element, which is an issue when that element includes
26+
/// an inline script that can trigger our vertical rhythm.
27+
.wp-block-jetpack-contact-form > .wp-block-jetpack-contact-form {
28+
margin-block-start: 0;
29+
}
30+
2431
/// Apply our existing form component styles to Jetpack form fields.
2532
.grunion-field {
2633
/// Test-based inputs

0 commit comments

Comments
 (0)