From 08986efdd5dfeb4f4f6647009939892596437ecc Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Thu, 11 May 2017 09:57:57 +0100 Subject: [PATCH] Image Block: Hide inline toolbar when we focus out of the caption editable --- blocks/library/image/index.js | 6 +++++- editor/modes/visual-editor/block.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/blocks/library/image/index.js b/blocks/library/image/index.js index 0cace66468552e..bf0039051a9db0 100644 --- a/blocks/library/image/index.js +++ b/blocks/library/image/index.js @@ -93,9 +93,12 @@ registerBlock( 'core/image', { const focusCaption = ( focusValue ) => setFocus( { editable: 'caption', ...focusValue } ); + // Disable reason: Each block can be selected by clicking on it + + /* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/onclick-has-role, jsx-a11y/click-events-have-key-events */ return (
- { + { { ( caption && caption.length > 0 ) || !! focus ? ( ); + /* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/onclick-has-role, jsx-a11y/click-events-have-key-events */ }, save( { attributes } ) { diff --git a/editor/modes/visual-editor/block.js b/editor/modes/visual-editor/block.js index 063ab8d4ec96cc..7da8c1033d72d7 100644 --- a/editor/modes/visual-editor/block.js +++ b/editor/modes/visual-editor/block.js @@ -239,7 +239,7 @@ class VisualEditorBlock extends wp.element.Component { ); - /* eslint-enable jsx-a11y/no-static-element-interactions */ + /* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/onclick-has-role, jsx-a11y/click-events-have-key-events */ } }