Skip to content

Commit

Permalink
Unassign click handlers from disabled mover buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth authored and youknowriad committed May 12, 2017
1 parent e63c61a commit d3c4425
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions editor/block-mover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,22 @@ 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"
aria-disabled={ isFirst }
/>
<IconButton
className="editor-block-mover__control"
onClick={ onMoveDown }
onClick={ isLast ? null : onMoveDown }
icon="arrow-down-alt2"
aria-disabled={ isLast }
/>
Expand Down

0 comments on commit d3c4425

Please sign in to comment.