From 8ff17a4e07e6d22b3d9d2b089f8deb9c13425edc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alba=20Rinc=C3=B3n?= Date: Fri, 29 Apr 2022 13:55:35 +0200 Subject: [PATCH] Hide alt if isRepeat is true When isRepeated is true, the image is a background so it does not make sense to have an alt attribute. --- assets/js/blocks/featured-product/block.js | 44 +++++++++++----------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/assets/js/blocks/featured-product/block.js b/assets/js/blocks/featured-product/block.js index ffbc0406bb8..9e35af837d3 100644 --- a/assets/js/blocks/featured-product/block.js +++ b/assets/js/blocks/featured-product/block.js @@ -378,30 +378,32 @@ const FeaturedProduct = ( { } ) } /> - { - setAttributes( { alt } ); - } } - help={ - <> - + { ! isRepeated && ( + { + setAttributes( { alt } ); + } } + help={ + <> + + { __( + 'Describe the purpose of the image', + 'woo-gutenberg-products-block' + ) } + { __( - 'Describe the purpose of the image', + 'Leaving it empty will use the product name.', 'woo-gutenberg-products-block' ) } - - { __( - 'Leaving it empty will use the product name.', - 'woo-gutenberg-products-block' - ) } - - } - /> + + } + /> + ) } ) }