Fix: Receipt header heading and description nested elements. #8216
Fix: Receipt header heading and description nested elements. #8216gilbert-hernandez wants to merge 3 commits intodevelopfrom
Conversation
| <Interweave tagName="h1" className="receipt-header-heading" content={stripWrappingParagraph(heading)} /> | ||
| <Interweave tagName="p" className="receipt-header-description" content={stripWrappingParagraph(description)} /> |
There was a problem hiding this comment.
@gilbert-hernandez i'd like to suggest a different approach. Although this will sort of fix the issue, it will hinder the intended flexibility of these fields. The idea here is customers can use the rich text field to edit the heading and description fields for the donation confirmation - but as you can see we hardcoded the tagName which kind of defeats the purpose of using a rich text 😏
People may want to add additional information to the donation confirmation that should actually render whatever tags they want to use (including p tags)
So what I would suggest, is we make these both wrapped in divs and let the rich text editor determine their tag. Then, we can update the initial styling here to target any tag. (people can always use custom css later to get specific).
I also don't like the fact we are hardcoding an h1 anyway.
We did something similar with the styling of the Form Header
| <Interweave tagName="h1" className="receipt-header-heading" content={stripWrappingParagraph(heading)} /> | |
| <Interweave tagName="p" className="receipt-header-description" content={stripWrappingParagraph(description)} /> | |
| <Interweave tagName="div" className="receipt-header-heading" content={heading} /> | |
| <Interweave tagName="div" className="receipt-header-description" content={description} /> |
There was a problem hiding this comment.
That makes sense. I see now that the heading and description are wysiwyg components and the inline styles there will overrule the default style, which are applied to any child element with this update.
There was a problem hiding this comment.
@gilbert-hernandez oh one more thing - we typically add @unreleased above an existing @since tag to mark the change. You should be able to add one to this file
jonwaldstein
left a comment
There was a problem hiding this comment.
@gilbert-hernandez nice job, your a Give dev now!
2 final requests, otherwise ready for QA 🌈
- Add an
@unreleasedtag when available - Update the PR title to reflect the new direction
@jonwaldstein UPDATE: Nevermind, I see your additional comments about it. |
|
@gilbert-hernandez all good, yeah we add those |
Resolves GIVE-3061
Description
Receipt header headings and descriptions added nested paragraph elements inside of the h1 and existing p tags after altering the settings for the heading and its description. This
Affects
The confirmation receipt heading in the visual builder and frontend.
Visuals
Here is the existing video of the problem: https://www.loom.com/share/c0b47c14211b40b5a5c491b5642ceada
Testing Instructions
Recreate the problem and ensure that the nested paragraph tags are stripped. The confirmation receipt header should use the correct styles after the content is altered from the default string.
Pre-review Checklist
@unreleasedtags included in DocBlocks