Skip to content

Commit 8b9d422

Browse files
vianaswmatticbot
authored andcommitted
Forms: Update form submission confirmation page template (#46521)
* Forms: Update form submission confirmation page template - Change back link text from 'Go back' to '← Back' - Update default heading to 'Thank you for your response.' - Add sparkle emoji (✨) decoration to heading - Update CSS for new design: - Centered layout with max-width 600px - Fields with label above value - Horizontal dividers between fields - Improved typography (muted labels, bold values) Co-Authored-By: Claude Opus 4.5 <[email protected]> * Simplify changelog copy * Forms: Update E2E test to match new confirmation heading Update the form submission E2E test to expect "Thank you for your response." instead of "Your message has been sent" to match the new default heading. Co-Authored-By: Claude Opus 4.5 <[email protected]> * Use CSS logical properties for RTL support - Change margin-left to margin-inline-start for sparkle decoration - Change text-align: left to text-align: start for go-back-message This addresses RTL language support by using logical CSS properties that automatically adapt to the text direction. Co-Authored-By: Claude Opus 4.5 <[email protected]> * Use theme-compatible colors for form submission page Replace hardcoded colors with theme-aware alternatives: - Border color: Use currentColor with color-mix() for 20% opacity, falling back to solid currentColor for older browsers - Field label: Use inherit with opacity for secondary text effect This ensures the submission confirmation page adapts to different WordPress themes instead of using fixed gray values. Co-Authored-By: Claude Opus 4.5 <[email protected]> * Make sparkle emoji part of default heading text Move the sparkle emoji from being hardcoded in the template to being part of the customThankyouHeading default value. This makes it automatically optional - users who customize the heading text will not have the sparkle unless they add it themselves. Also adds get_translated_with_fallback() helper to show the previous translation ("Your message has been sent") if the new string ("Thank you for your response.") hasn't been translated yet. Removes the now-unused .sparkle-decoration CSS class. Co-Authored-By: Claude Opus 4.5 <[email protected]> * Add translation fallback for thank you heading When the new heading copy ("Thank you for your response.") hasn't been translated yet, fall back to the old copy ("Your message has been sent") without the sparkle emoji. This ensures non-English users see translated text rather than untranslated English during the transition period. Co-Authored-By: Claude Opus 4.5 <[email protected]> * Fix Phan error in translation check Use string comparison instead of translate_entry() which expects a Translation_Entry object, not a string. Co-Authored-By: Claude Opus 4.5 <[email protected]> --------- Co-authored-by: Claude Opus 4.5 <[email protected]> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/20965369221 Upstream-Ref: Automattic/jetpack@8e6cfcf
1 parent fe26f63 commit 8b9d422

File tree

14 files changed

+213
-159
lines changed

14 files changed

+213
-159
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ This is an alpha version! The changes listed here are not final.
1414
- Slideshow: Ensure slideshows do not stretch to parent container width on mobile if no list height is set.
1515

1616
### Other changes <!-- Non-user-facing changes go here. This section will not be copied to readme.txt. -->
17+
- Forms: update E2E test to match new form submission confirmation heading.
1718
- Tests: Add coverage for modules added to sync configuration mid-progress.
1819
- Update composer lock following Publicize changes.
1920

jetpack_vendor/automattic/jetpack-forms/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ This is an alpha version! The changes listed here are not final.
1515

1616
### Changed
1717
- Forms: update dataviews actions to match between old and new dashboard.
18+
- Forms: update form submission confirmation page with new design.
1819
- Update package dependencies.
1920
- Update read/unread status column style to match old dashboard.
2021
- Use Gravatar component in new dashboard inbox.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('jetpack-connection', 'jetpack-script-data', 'lodash', 'react', 'react-jsx-runtime', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-jp-i18n-loader', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => 'a6321396bb8add9aa94d');
1+
<?php return array('dependencies' => array('jetpack-connection', 'jetpack-script-data', 'lodash', 'react', 'react-jsx-runtime', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-jp-i18n-loader', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => '9838c0cd174b9c148855');

jetpack_vendor/automattic/jetpack-forms/dist/blocks/editor.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jetpack_vendor/automattic/jetpack-forms/dist/contact-form/css/grunion-rtl.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jetpack_vendor/automattic/jetpack-forms/dist/contact-form/css/grunion.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jetpack_vendor/automattic/jetpack-forms/src/blocks/contact-form/attributes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default {
1818
},
1919
customThankyouHeading: {
2020
type: 'string',
21-
default: __( 'Your message has been sent', 'jetpack-forms' ),
21+
default: __( 'Thank you for your response.', 'jetpack-forms' ),
2222
},
2323
customThankyouMessage: {
2424
type: 'string',

jetpack_vendor/automattic/jetpack-forms/src/blocks/contact-form/edit.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ function JetpackContactFormEdit( {
868868
<TextControl
869869
label={ __( 'Message heading', 'jetpack-forms' ) }
870870
value={ customThankyouHeading }
871-
placeholder={ __( 'Your message has been sent', 'jetpack-forms' ) }
871+
placeholder={ __( 'Thank you for your response.', 'jetpack-forms' ) }
872872
onChange={ ( newHeading: string ) =>
873873
setAttributes( { customThankyouHeading: newHeading } )
874874
}

jetpack_vendor/automattic/jetpack-forms/src/contact-form/class-contact-form.php

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public function __construct( $attributes, $content = null, $set_id = true ) {
205205
'submit_button_text' => __( 'Submit', 'jetpack-forms' ),
206206
// These attributes come from the block editor, so use camel case instead of snake case.
207207
'customThankyou' => '', // Whether to show a custom thankyou response after submitting a form. '' for no, 'noSummary' to disable the summary, 'message' for a custom message, 'redirect' to redirect to a new URL. Deprecated.
208-
'customThankyouHeading' => __( 'Your message has been sent', 'jetpack-forms' ), // The text to show above customThankyouMessage.
208+
'customThankyouHeading' => self::get_default_thank_you_heading(), // The text to show above customThankyouMessage.
209209
'customThankyouMessage' => '', // The message to show when customThankyou is set to 'message'.
210210
'customThankyouRedirect' => '', // The URL to redirect to when confirmationType is set to 'redirect'.
211211
'confirmationType' => null, // The type of confirmation to show after submitting a form. 'text' for a text message, 'redirect' for a redirect link.
@@ -600,6 +600,35 @@ private static function get_secret() {
600600
return $secret;
601601
}
602602

603+
/**
604+
* Get the default thank you heading with conditional sparkle.
605+
*
606+
* Returns the new copy with sparkle emoji if translated, otherwise
607+
* falls back to the old copy without sparkle.
608+
*
609+
* TEMPORARY: This method can be removed once the new copy has been translated.
610+
* Replace the call with: __( 'Thank you for your response.', 'jetpack-forms' ) . ' ✨'
611+
*
612+
* @return string The translated heading.
613+
*/
614+
private static function get_default_thank_you_heading() {
615+
// English locales always get the new copy with sparkle.
616+
if ( str_starts_with( get_locale(), 'en' ) ) {
617+
return __( 'Thank you for your response.', 'jetpack-forms' ) . '';
618+
}
619+
620+
// Check if new string has a translation by comparing with the original.
621+
$original = 'Thank you for your response.';
622+
$translated = __( 'Thank you for your response.', 'jetpack-forms' );
623+
624+
if ( $translated !== $original ) {
625+
return $translated . '';
626+
}
627+
628+
// Fall back to old string without sparkle.
629+
return __( 'Your message has been sent', 'jetpack-forms' );
630+
}
631+
603632
/**
604633
* Helper function to get the attributes of the contact form.
605634
*
@@ -1342,7 +1371,7 @@ private static function render_noscript_success_message( $is_reload_nonce_valid,
13421371
$success_message = '';
13431372

13441373
if ( ! $disable_go_back ) {
1345-
$success_message = '<p class="go-back-message"> <a class="link" href="' . esc_url( $back_url ) . '">' . esc_html__( 'Go back', 'jetpack-forms' ) . '</a> </p>';
1374+
$success_message = '<p class="go-back-message"> <a class="link" href="' . esc_url( $back_url ) . '">' . esc_html__( '← Back', 'jetpack-forms' ) . '</a> </p>';
13461375
}
13471376

13481377
$success_message .= '<h4 id="contact-form-success-header">' . esc_html( $form->get_attribute( 'customThankyouHeading' ) ) . "</h4>\n\n";
@@ -1437,7 +1466,7 @@ private static function render_ajax_success_wrapper( $form, $submission_success
14371466

14381467
if ( ! $disable_go_back ) {
14391468
$html .= '<p class="go-back-message">';
1440-
$html .= '<a class="link" role="button" tabindex="0" data-wp-on--click="actions.goBack" href="' . esc_url( $back_url ) . '">' . esc_html__( 'Go back', 'jetpack-forms' ) . '</a>';
1469+
$html .= '<a class="link" role="button" tabindex="0" data-wp-on--click="actions.goBack" href="' . esc_url( $back_url ) . '">' . esc_html__( '← Back', 'jetpack-forms' ) . '</a>';
14411470
$html .= '</p>';
14421471
}
14431472

jetpack_vendor/automattic/jetpack-forms/src/contact-form/css/grunion.scss

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,10 @@ that needs to mimic the input element styles */
224224

225225
.contact-form-submission {
226226
box-sizing: border-box;
227-
margin-bottom: 4em;
228-
padding: 1.5em 1em;
227+
margin: 0 auto 4em;
228+
padding: 0;
229229
width: 100%;
230-
border-top: 1px solid #000;
231-
border-bottom: 1px solid #000;
230+
max-width: 600px;
232231
}
233232

234233
.contact-form-submission p {
@@ -250,32 +249,55 @@ that needs to mimic the input element styles */
250249
}
251250

252251
.contact-form-submission h4 {
253-
margin-top: 32px;
254-
margin-bottom: 32px;
255-
font-weight: 200;
252+
margin-top: 16px;
253+
margin-bottom: 40px;
254+
font-size: 1.75rem;
255+
font-weight: 500;
256+
line-height: 1.3;
256257
}
257258

258259
.contact-form-submission .go-back-message {
259-
margin-top: 20px;
260-
margin-bottom: 32px;
261-
text-align: left;
260+
margin-top: 0;
261+
margin-bottom: 0;
262+
text-align: start;
262263
}
263264

264265
.contact-form-submission .go-back-message .link {
265-
font-weight: 200;
266+
font-size: 0.875rem;
267+
font-weight: 400;
266268
color: inherit;
269+
text-decoration: none;
267270
cursor: pointer;
271+
272+
&:hover {
273+
text-decoration: underline;
274+
}
275+
}
276+
277+
.contact-form-submission .jetpack_forms_contact-form-success-summary {
278+
padding: 24px 0;
279+
border-bottom: 1px solid currentColor;
280+
border-bottom-color: color-mix(in sRGB, currentColor 20%, transparent);
281+
282+
&:first-of-type {
283+
border-top: 1px solid currentColor;
284+
border-top-color: color-mix(in sRGB, currentColor 20%, transparent);
285+
}
268286
}
269287

270288
.contact-form-submission .field-name {
271-
font-weight: 200;
289+
font-size: 0.875rem;
290+
font-weight: 400;
291+
color: inherit;
292+
opacity: 0.6;
293+
margin-bottom: 8px;
272294
}
273295

274296
.contact-form-submission .field-images {
275297
display: flex;
276298
flex-wrap: wrap;
277299
gap: 16px;
278-
margin-bottom: 20px;
300+
margin-top: 8px;
279301

280302
&[hidden] {
281303
display: none;
@@ -308,7 +330,8 @@ that needs to mimic the input element styles */
308330
}
309331

310332
.contact-form-submission .field-value {
311-
margin-bottom: 20px;
333+
margin-bottom: 0;
334+
font-size: 1rem;
312335
font-weight: 600;
313336
white-space: pre-wrap;
314337
}

0 commit comments

Comments
 (0)