Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Hide alt if isRepeat is true
Browse files Browse the repository at this point in the history
When isRepeated is true, the image is a background so it does not
make sense to have an alt attribute.
  • Loading branch information
albarin committed May 2, 2022
1 parent abc297a commit 8ff17a4
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions assets/js/blocks/featured-product/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,30 +378,32 @@ const FeaturedProduct = ( {
} )
}
/>
<TextareaControl
label={ __(
'Alt text (alternative text)',
'woo-gutenberg-products-block'
) }
value={ attributes.alt }
onChange={ ( alt ) => {
setAttributes( { alt } );
} }
help={
<>
<ExternalLink href="https://www.w3.org/WAI/tutorials/images/decision-tree">
{ ! isRepeated && (
<TextareaControl
label={ __(
'Alt text (alternative text)',
'woo-gutenberg-products-block'
) }
value={ attributes.alt }
onChange={ ( alt ) => {
setAttributes( { alt } );
} }
help={
<>
<ExternalLink href="https://www.w3.org/WAI/tutorials/images/decision-tree">
{ __(
'Describe the purpose of the image',
'woo-gutenberg-products-block'
) }
</ExternalLink>
{ __(
'Describe the purpose of the image',
'Leaving it empty will use the product name.',
'woo-gutenberg-products-block'
) }
</ExternalLink>
{ __(
'Leaving it empty will use the product name.',
'woo-gutenberg-products-block'
) }
</>
}
/>
</>
}
/>
) }
</PanelBody>
) }
<PanelColorGradientSettings
Expand Down

0 comments on commit 8ff17a4

Please sign in to comment.