-
Notifications
You must be signed in to change notification settings - Fork 194
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
Fix: Apply taggedElement to improve iframe height resizing in v3 forms #7607
Conversation
(new EnqueueScript( | ||
'givewp-donation-form-embed', | ||
'build/donationFormEmbed.js', | ||
GIVE_PLUGIN_DIR, | ||
GIVE_PLUGIN_URL, | ||
'give' | ||
))->loadInFooter()->enqueue(); | ||
|
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.
This script is also used in the confirmation page, let's just make sure there are no side effects there (I believe it's loaded seperately)
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.
Yes! The videos up top are actually me just testing via different form rendering. At the very end I inspect the Iframe on the confirmation page & you can see the taggedElement and the iframe rendered which does not hold the data-givewp-embed
so it's not being targeted by the file.
@@ -73,6 +73,7 @@ function DonationFormBlockApp({ | |||
id={embedId} | |||
src={dataSrc} | |||
checkOrigin={false} | |||
heightCalculationMethod={'taggedElement'} |
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.
I revisited the original embed file and remembered that I added the iframe resizer to look for the data attribute data-givewp-embed
. Is that still at thing?
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.
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.
Okay so if i'm understanding correctly, we don't need the embed script for the donation form because we are using the react version, but the confirmation page does not use that so we still need the vanilla embed script. That sound right?
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.
Yes, the confirmation page displayed through the standard form submission process still uses the React version. However, confirmation pages generated through other methods, such as shortcodes, will still require the embed script to function properly.
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.
@JoshuaHungDinh nice job!
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.
Passed manual QA tests.
Resolves GIVE-1429
Description
This includes the
heightCalculation
prop on the Iframe-Resizer-react component for v3 forms. The taggedElement used can be found in theDonationFormViewModel.php
class. The element can be found viaid="root-givewp-donation-form"
. taggedElements are denoted viadata-iframe-height
I also noticed the parent page script for the iframe-resizer JS package in
embed.ts
was enqueued for v3 forms. It is targeting an iframe viaiframe[data-givewp-embed]
which does not align with the iframe currently used to render v3 forms.The iframe-resizer-react documents do not explicitly mention to load the parent page script. So I have removed the script from enqueuing. Reference: https://www.npmjs.com/package/iframe-resizer-react/v/1.1.0
Additional Context
NextGen
version theBlockRenderController
rendered an iframe with the data attributedata-givewp-embed
Reference: Pull Request
File:
src/NextGen/DonationForm/Blocks/DonationFormBlock/Controllers/BlockRenderController.php
Affects
v3 forms on the frontend, including confirmation pages.
Visuals
Testing v3 Forms
testing.v3.forms.mov
Testing v3 Forms as a
Block
&Shortcode
testing.block.and.shortcodes.mov
Testing v2 Forms
testing-v2-forms.mov
Testing Instructions
Pre-review Checklist
@unreleased
tags included in DocBlocks