-
-
Notifications
You must be signed in to change notification settings - Fork 830
Fix spacing problem of paragraphs around lists #10305
Conversation
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
res/css/views/rooms/_EventTile.pcss
Outdated
.mx_EventTile_content .markdown-body { | ||
p, | ||
ul, | ||
ol, |
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 am not sure if the margin-bottom for ul
and ol
on compact modern layout has been expected, as the other layouts do not have margin-bottom for them.
// Check block margin values of paragraphs and lists on compact modern layout | ||
cy.setSettingValue("useCompactLayout", null, SettingLevel.DEVICE, true); | ||
cy.get(".mx_EventTile[data-layout=group] .markdown-body").within(() => { | ||
cy.get("ul").should("have.css", "margin-block", "0px 4px"); |
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.
If ul and ol margin is in fact not expected here, this needs to be replaced as well. https://github.com/matrix-org/matrix-react-sdk/pull/10305/files#r1127766737
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.
Thanks for looking at this. A few questions and comments below.
Generally: as I understand it, this works by setting a margin-top
for <p>
elements which follow a list. What is the reason for doing that, rather than setting a margin-bottom
on lists, to bring them into line with the other block elements? I'm worried that with all these overrides, we're making the CSS very hard to reason about, and that there may be other situations that this won't fix.
The problematic margin-bottom
override appears to have been introduced in #9871, though I don't entirely follow why it was required. As the author of that PR, @alunturner can you shed any light on it?
res/css/views/rooms/_EventTile.pcss
Outdated
:is(ul, ol) + p { | ||
margin-block: $spacing-16; | ||
} |
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 seems to be directly overriding the settings at lines 647-650. Do we really need both settings?
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.
Are you suggesting that ul + p
and ol + p
would be covered by :is(blockquote > p, ol, ul)
?
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.
Erm, I'm mostly asking the same question as in the review summary:
Generally: as I understand it, this works by setting a
margin-top
for<p>
elements which follow a list. What is the reason for doing that, rather than setting amargin-bottom
on lists, to bring them into line with the other block elements? I'm worried that with all these overrides, we're making the CSS very hard to reason about, and that there may be other situations that this won't fix.
@@ -648,6 +648,32 @@ $left-gutter: 64px; | |||
margin-top: 0; |
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 don't really know why we need a margin-top
here. As far as I can tell, it's the default anyway)
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.
Me nether.
res/css/views/rooms/_EventTile.pcss
Outdated
/* Paragraph below ul or ol */ | ||
:is(ul, ol) + p { | ||
margin-block: $spacing-4; | ||
} |
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.
again, how does this interact with the settings at lines 647-650?
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.
Ditto
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
Closing for now as setting up a well-thought test set for lists should be done at first. |
Hello
Hello! This work was carried out before I was aware that we were having clashes in the timeline when trying to apply styling purely to the output of the wysiwyg composer. That specific override was put in to handle consecutive list display from the rich text editor, but if it breaks other things, I think it's sensible to be taken out. This is exactly what I did in #10071 to revert an unseen issue with paragraph spacing caused by wysiwyg work. |
This PR intends to fix a spacing problem of paragraphs (
p
) around lists (ul
andol
) inside.markdown-body
.Fixes element-hq/element-web#24602
Signed-off-by: Suguru Hirahara luixxiul@users.noreply.github.com
type: defect
Checklist
Here's what your changelog entry will look like:
🐛 Bug Fixes