-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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 double margins in RTE when non-paragraphs are used #2403
Conversation
In some templates we use the E.g. dawn/sections/main-product.liquid Line 166 in 6d4ec13
dawn/sections/main-page.liquid Line 21 in 6d4ec13
https://github.com/Shopify/dawn/blob/main/sections/main-article.liquid#L59 |
@stufreen Thanks! I just double checked as many of those use cases as I could think of, and I'm not seeing any visual changes after the rule is applied. I'll add a note to the testing instructions for other folks to look too though. 👍 |
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.
Tested every section/template I saw that used the .rte
class and it all seem good 👍
Whoops, I forgot about this one for a while. 😅 @stufreen do you have a minute for a second review? |
@@ -3157,11 +3157,11 @@ details-disclosure > details { | |||
display: block; | |||
} | |||
|
|||
.rte > p:first-child { | |||
.rte > *:first-child { |
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.
It's not a blocker but just calling out that this issue didn't really occur in the Richtext section because the styling there is different. There is a rule in the richtext heading block to remove the bottom margin.
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.
For the page I think it depends. Sometimes things get copied over in the rich text editor and it pastes in some unwanted elements like this.
If you look at some other pages like a complete page
, it's not there. So it's not added by the RTE from the admin but more so due to the way content can be added I believe 🤔
PR Summary:
Fixes unintentional double margins generated by non-paragraph tags in the Rich Text editor.
Why are these changes introduced?
Fixes #2416
Recent updates to the Rich Text editor now allow it to use headings and lists, in addition to paragraphs. Dawn today clears out the top and bottom margins of paragraphs inside of the Rich Text editor. These new tags were not targeted by our existing rule, resulting in more vertical space between elements than we'd originally designed for there to be.
What approach did you take?
I used a wildcard here — I can't think of a reason why we wouldn't want to clear these extra margins. But if folks feel otherwise, it's easy enough to just add a bunch of rules for all the currently-supported tags instead (
.rte > h1:first-child
,.rte > h2:first-child
, etc.). The downside is just that it's far more code, and could break again if we allow more tags in here in the future.Visual impact on existing themes
Paragraph Tags (No Change)
H2 Tags
H3 Tags
This also effects
ul
,ol
, andh1-h6
, but the effect is the same.Testing steps/scenarios
rte
and look for visual changes. (i.e. product descriptions, blog posts, and pages). There should be no visual change when this PR is active.Demo links
Checklist