Skip to content

Commit

Permalink
Limit contrast checker to only blocks that have at least one color de…
Browse files Browse the repository at this point in the history
…fined (#43592)
  • Loading branch information
glendaviesnz committed Sep 8, 2022
1 parent fa80a98 commit b9a2477
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/block-editor/src/hooks/color-panel.js
Expand Up @@ -26,9 +26,10 @@ export default function ColorPanel( {
const [ detectedColor, setDetectedColor ] = useState();
const [ detectedLinkColor, setDetectedLinkColor ] = useState();
const ref = useBlockRef( clientId );
const definedColors = settings.filter( ( setting ) => setting?.colorValue );

useEffect( () => {
if ( ! enableContrastChecking ) {
if ( ! enableContrastChecking || ! definedColors.length ) {
return;
}

Expand Down

0 comments on commit b9a2477

Please sign in to comment.