From 5911a54c3afc4505ea4bb4626267a675fdf68b36 Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Fri, 16 Dec 2022 16:33:01 +0800 Subject: [PATCH] Prevent styles interfering with global styles and block supports --- .../src/latest-comments/style.scss | 32 +++++++++++++++---- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/packages/block-library/src/latest-comments/style.scss b/packages/block-library/src/latest-comments/style.scss index ba088731ee412..ea0f32eb2cbe6 100644 --- a/packages/block-library/src/latest-comments/style.scss +++ b/packages/block-library/src/latest-comments/style.scss @@ -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; +} + +.has-dates, +.has-excerpts { + :where(.wp-block-latest-comments:not([style*="line-height"])) { + line-height: 1.5; + } +} + +:where(.wp-block-latest-comments:not([style*="line-height"] .wp-block-latest-comments__comment-excerpt p)) { + line-height: 1.8; +} + // 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; + } +}