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

Commit

Permalink
Don't allow alt if the image is a bg not an img element
Browse files Browse the repository at this point in the history
  • Loading branch information
albarin committed May 18, 2022
1 parent ddb82b0 commit b6e4bf2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion assets/js/blocks/featured-product/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ const FeaturedProduct = ( {
// so we need to check if it exists before using it.
const focalPointPickerExists = typeof FocalPointPicker === 'function';

const isImgElement = ! isRepeated && ! hasParallax;

return (
<>
<InspectorControls key="inspector">
Expand Down Expand Up @@ -404,7 +406,7 @@ const FeaturedProduct = ( {
} )
}
/>
{ ! isRepeated && (
{ isImgElement && (
<TextareaControl
label={ __(
'Alt text (alternative text)',
Expand Down Expand Up @@ -807,6 +809,7 @@ export default compose( [
state = {
doUrlUpdate: false,
};

componentDidUpdate() {
const {
attributes,
Expand All @@ -828,9 +831,11 @@ export default compose( [
this.setState( { doUrlUpdate: false } );
}
}

triggerUrlUpdate = () => {
this.setState( { doUrlUpdate: true } );
};

render() {
return (
<ProductComponent
Expand All @@ -840,6 +845,7 @@ export default compose( [
);
}
}

return WrappedComponent;
}, 'withUpdateButtonAttributes' ),
] )( FeaturedProduct );

0 comments on commit b6e4bf2

Please sign in to comment.