diff --git a/packages/block-library/src/post-featured-image/block.json b/packages/block-library/src/post-featured-image/block.json
index 1072c7576d6454..40f51cffa06e75 100644
--- a/packages/block-library/src/post-featured-image/block.json
+++ b/packages/block-library/src/post-featured-image/block.json
@@ -62,7 +62,7 @@
"color": true,
"radius": true,
"width": true,
- "__experimentalSelector": "img, .block-editor-media-placeholder",
+ "__experimentalSelector": "img, .block-editor-media-placeholder, .wp-block-post-featured-image__overlay",
"__experimentalSkipSerialization": true,
"__experimentalDefaultControls": {
"color": true,
diff --git a/packages/block-library/src/post-featured-image/index.php b/packages/block-library/src/post-featured-image/index.php
index 552811f6d2f21d..00b9ab301654e1 100644
--- a/packages/block-library/src/post-featured-image/index.php
+++ b/packages/block-library/src/post-featured-image/index.php
@@ -85,7 +85,14 @@ function get_block_core_post_featured_image_overlay_element_markup( $attributes
return '';
}
+ $styles = '';
+ $border_attributes = get_block_core_post_featured_image_border_attributes( $attributes );
+
// Generate required classes for the element.
+ if ( ! empty( $border_attributes['class'] ) ) {
+ $class_names[] = $border_attributes['class'];
+ }
+
if ( $has_dim_background ) {
$class_names[] = 'has-background-dim';
$class_names[] = "has-background-dim-{$attributes['dimRatio']}";
@@ -104,12 +111,8 @@ function get_block_core_post_featured_image_overlay_element_markup( $attributes
}
// Generate required CSS properties and their values.
- if ( ! empty( $attributes['style']['border']['radius'] ) ) {
- $styles_properties['border-radius'] = $attributes['style']['border']['radius'];
- }
-
- if ( ! empty( $attributes['style']['border']['width'] ) ) {
- $styles_properties['border-width'] = $attributes['style']['border']['width'];
+ if ( ! empty( $border_attributes['style'] ) ) {
+ $styles = "{$border_attributes['style']} ";
}
if ( $has_custom_gradient ) {
@@ -120,8 +123,6 @@ function get_block_core_post_featured_image_overlay_element_markup( $attributes
$styles_properties['background-color'] = $attributes['customOverlayColor'];
}
- $styles = '';
-
foreach ( $styles_properties as $style_attribute => $style_attribute_value ) {
$styles .= "{$style_attribute}: $style_attribute_value; ";
}
diff --git a/packages/block-library/src/post-featured-image/overlay.js b/packages/block-library/src/post-featured-image/overlay.js
index 572cef64801e76..2c1cbac1d9ed6e 100644
--- a/packages/block-library/src/post-featured-image/overlay.js
+++ b/packages/block-library/src/post-featured-image/overlay.js
@@ -47,20 +47,22 @@ const Overlay = ( {
return (
<>
-
+ { !! dimRatio && (
+
+ ) }