Skip to content

Commit

Permalink
Image Block: Hide inline toolbar when we focus out of the caption edi…
Browse files Browse the repository at this point in the history
…table (#762)
  • Loading branch information
youknowriad authored May 11, 2017
1 parent 57807d5 commit 876a44f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion blocks/library/image/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<figure className="blocks-image">
<img src={ url } alt={ alt } />
<img src={ url } alt={ alt } onClick={ setFocus } />
{ ( caption && caption.length > 0 ) || !! focus ? (
<Editable
tagName="figcaption"
Expand All @@ -110,6 +113,7 @@ registerBlock( 'core/image', {
) : null }
</figure>
);
/* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/onclick-has-role, jsx-a11y/click-events-have-key-events */
},

save( { attributes } ) {
Expand Down
2 changes: 1 addition & 1 deletion editor/modes/visual-editor/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ class VisualEditorBlock extends wp.element.Component {
</div>
</div>
);
/* 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 */
}
}

Expand Down

0 comments on commit 876a44f

Please sign in to comment.