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

Blocks: Unselect the block when clicking outside the current block #730

Merged
merged 3 commits into from
May 12, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions blocks/editable/format-toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ class FormatToolbar extends wp.element.Component {
} );
}

/* eslint-disable jsx-a11y/no-autofocus */
return (
<div className="editable-format-toolbar">
<Toolbar controls={ toolbarControls } />
Expand All @@ -134,6 +135,7 @@ class FormatToolbar extends wp.element.Component {
style={ linkStyle }
onSubmit={ this.submitLink }>
<input
autoFocus
className="editable-format-toolbar__link-input"
type="url"
required
Expand All @@ -156,6 +158,7 @@ class FormatToolbar extends wp.element.Component {
}
</div>
);
/* eslint-enable jsx-a11y/no-autofocus */
}
}

Expand Down
13 changes: 9 additions & 4 deletions editor/block-mover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,24 @@ import './style.scss';
import { isFirstBlock, isLastBlock } from '../selectors';

function BlockMover( { onMoveUp, onMoveDown, isFirst, isLast } ) {
// We emulate a disabled state because forcefully applying the `disabled`
// attribute on the button while it has focus causes the screen to change
// to an unfocused state (body as active element) without firing blur on,
// the rendering parent, leaving it unable to react to focus out.

return (
<div className="editor-block-mover">
<IconButton
className="editor-block-mover__control"
onClick={ onMoveUp }
onClick={ isFirst ? null : onMoveUp }
icon="arrow-up-alt2"
disabled={ isFirst }
aria-disabled={ isFirst }
/>
<IconButton
className="editor-block-mover__control"
onClick={ onMoveDown }
onClick={ isLast ? null : onMoveDown }
icon="arrow-down-alt2"
disabled={ isLast }
aria-disabled={ isLast }
/>
</div>
);
Expand Down
3 changes: 2 additions & 1 deletion editor/block-mover/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
color: $dark-gray-900;
}

&[disabled] {
&[aria-disabled="true"] {
cursor: default;
color: $light-gray-300;
pointer-events: none;
}

.dashicon {
Expand Down