Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image Block: Hide inline toolbar when we focus out of the caption editable #762

Merged
merged 1 commit into from
May 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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