From 6658798e2c677661c5c59555355a97a46841e3d6 Mon Sep 17 00:00:00 2001 From: Rafael Galani Date: Thu, 29 Aug 2024 12:50:22 -0300 Subject: [PATCH 1/3] Apply styles for element + `a` child when present --- packages/block-library/src/post-title/block.json | 5 ++++- packages/block-library/src/site-title/block.json | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/block-library/src/post-title/block.json b/packages/block-library/src/post-title/block.json index ecb5053d6cd39e..5e7d3eee9dd11d 100644 --- a/packages/block-library/src/post-title/block.json +++ b/packages/block-library/src/post-title/block.json @@ -80,5 +80,8 @@ } } }, - "style": "wp-block-post-title" + "style": "wp-block-post-title", + "selectors": { + "typography": ".wp-block-post-title, .wp-block-post-title > a" + } } diff --git a/packages/block-library/src/site-title/block.json b/packages/block-library/src/site-title/block.json index c75b1bc229beb9..dbb484c74a1e45 100644 --- a/packages/block-library/src/site-title/block.json +++ b/packages/block-library/src/site-title/block.json @@ -75,5 +75,8 @@ } }, "editorStyle": "wp-block-site-title-editor", - "style": "wp-block-site-title" + "style": "wp-block-site-title", + "selectors": { + "typography": ".wp-block-site-title > span, .wp-block-site-title > a" + } } From 80e9f1461968498ed2a296e1b93530d5f9c52c14 Mon Sep 17 00:00:00 2001 From: Rafael Galani Date: Thu, 29 Aug 2024 12:50:56 -0300 Subject: [PATCH 2/3] Inherit styles from parent element when present --- .../block-library/src/post-title/style.scss | 23 +++++++++++++++++++ .../block-library/src/site-title/style.scss | 23 +++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/packages/block-library/src/post-title/style.scss b/packages/block-library/src/post-title/style.scss index abeb4454bcb2c5..ac750d30d022bd 100644 --- a/packages/block-library/src/post-title/style.scss +++ b/packages/block-library/src/post-title/style.scss @@ -3,6 +3,29 @@ // This block has customizable padding, border-box makes that more predictable. box-sizing: border-box; + &[style*="font-weight"] :where(a) { + font-weight: inherit; + } + &[style*="font-family"] :where(a) { + font-family: inherit; + } + &[class*="-font-size"] :where(a), + &[style*="font-size"] :where(a) { + font-size: inherit; + } + &[style*="line-height"] :where(a) { + line-height: inherit; + } + &[style*="font-style"] :where(a) { + font-style: inherit; + } + &[style*="letter-spacing"] :where(a) { + letter-spacing: inherit; + } + &[style*="text-decoration"] :where(a) { + text-decoration: inherit; + } + a { display: inline-block; } diff --git a/packages/block-library/src/site-title/style.scss b/packages/block-library/src/site-title/style.scss index f292326cc3259f..54c63a5695d03c 100644 --- a/packages/block-library/src/site-title/style.scss +++ b/packages/block-library/src/site-title/style.scss @@ -2,6 +2,29 @@ // This block has customizable padding, border-box makes that more predictable. box-sizing: border-box; + &[style*="font-weight"] :where(a) { + font-weight: inherit; + } + &[style*="font-family"] :where(a) { + font-family: inherit; + } + &[class*="-font-size"] :where(a), + &[style*="font-size"] :where(a) { + font-size: inherit; + } + &[style*="line-height"] :where(a) { + line-height: inherit; + } + &[style*="font-style"] :where(a) { + font-style: inherit; + } + &[style*="letter-spacing"] :where(a) { + letter-spacing: inherit; + } + &[style*="text-decoration"] :where(a) { + text-decoration: inherit; + } + :where(a) { color: inherit; } From f7e711989416995dbca97db38f1754e9d1bdd335 Mon Sep 17 00:00:00 2001 From: Rafael Galani Date: Thu, 29 Aug 2024 18:36:11 -0300 Subject: [PATCH 3/3] Add missing `-font-family` attribute selector --- packages/block-library/src/post-title/style.scss | 1 + packages/block-library/src/site-title/style.scss | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/block-library/src/post-title/style.scss b/packages/block-library/src/post-title/style.scss index ac750d30d022bd..5d0e3407105bd4 100644 --- a/packages/block-library/src/post-title/style.scss +++ b/packages/block-library/src/post-title/style.scss @@ -6,6 +6,7 @@ &[style*="font-weight"] :where(a) { font-weight: inherit; } + &[class*="-font-family"] :where(a), &[style*="font-family"] :where(a) { font-family: inherit; } diff --git a/packages/block-library/src/site-title/style.scss b/packages/block-library/src/site-title/style.scss index 54c63a5695d03c..8647f3d9b2947c 100644 --- a/packages/block-library/src/site-title/style.scss +++ b/packages/block-library/src/site-title/style.scss @@ -5,6 +5,7 @@ &[style*="font-weight"] :where(a) { font-weight: inherit; } + &[class*="-font-family"] :where(a), &[style*="font-family"] :where(a) { font-family: inherit; }