Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent styles interfering with global styles and block supports
Browse files Browse the repository at this point in the history
aaronrobertshaw committed Feb 9, 2023
1 parent 2432a98 commit 565e365
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions packages/block-library/src/latest-comments/style.scss
Original file line number Diff line number Diff line change
@@ -9,6 +9,23 @@ ol.wp-block-latest-comments {
box-sizing: border-box;
}

// Following styles leverage :where so that typography block support styles and
// global styles apply when necessary.
:where(.wp-block-latest-comments:not([style*="line-height"] .wp-block-latest-comments__comment)) {
line-height: 1.1;
}

:where(.wp-block-latest-comments:not([style*="line-height"] .wp-block-latest-comments__comment-excerpt p)) {
line-height: 1.8;
}

.has-dates,
.has-excerpts {
:where(.wp-block-latest-comments:not([style*="line-height"])) {
line-height: 1.5;
}
}

// Higher specificity - target list via wrapper.
.wp-block-latest-comments .wp-block-latest-comments {
// Remove left spacing. Higher specificity required to
@@ -17,7 +34,6 @@ ol.wp-block-latest-comments {
}

.wp-block-latest-comments__comment {
line-height: 1.1;
list-style: none;
margin-bottom: 1em;

@@ -30,16 +46,10 @@ ol.wp-block-latest-comments {
margin-left: 3.25em;
}
}

.has-dates &,
.has-excerpts & {
line-height: 1.5;
}
}

.wp-block-latest-comments__comment-excerpt p {
font-size: 0.875em;
line-height: 1.8;
margin: 0.36em 0 1.4em;
}

@@ -57,3 +67,11 @@ ol.wp-block-latest-comments {
margin-right: 0.75em;
width: 2.5em;
}

// Enforce font size when user has made selection at the individual block level.
.wp-block-latest-comments[style*="font-size"],
.wp-block-latest-comments[class*="-font-size"] {
a {
font-size: inherit;
}
}

0 comments on commit 565e365

Please sign in to comment.