From 5ca55507bdf6efc5f0826b37ae446bb80a442735 Mon Sep 17 00:00:00 2001 From: RahiDroid Date: Tue, 20 Sep 2022 00:53:41 +0530 Subject: [PATCH 1/3] Fix: Ensure border radius applies to the overlay --- packages/block-library/src/post-featured-image/block.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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, From 3d55c7efd7c0d7cfe31e5583093eee5690f74344 Mon Sep 17 00:00:00 2001 From: RahiDroid Date: Tue, 20 Sep 2022 01:15:36 +0530 Subject: [PATCH 2/3] Fix: Ensure border attributes apply to overlay --- .../src/post-featured-image/index.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/block-library/src/post-featured-image/index.php b/packages/block-library/src/post-featured-image/index.php index 931d87c0265c10..d207400cc40550 100644 --- a/packages/block-library/src/post-featured-image/index.php +++ b/packages/block-library/src/post-featured-image/index.php @@ -92,7 +92,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']}"; @@ -111,12 +118,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 ) { @@ -127,8 +130,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; "; } From 5f7d532b910da88d65d454f9756f714a2001d52e Mon Sep 17 00:00:00 2001 From: RahiDroid Date: Wed, 21 Sep 2022 17:39:43 +0530 Subject: [PATCH 3/3] Fix: Avoid rendering overlay when opacity is 0 --- .../src/post-featured-image/overlay.js | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) 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 ( <> -