From 1f159f6a680667a5eab5b63267c9a2eb3326018a Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Fri, 12 May 2017 08:57:23 +0100 Subject: [PATCH 1/3] Blocks: Unselect the first block properly - The disalbed state caused a focus jump. Big props to @aduth --- editor/block-mover/index.js | 4 ++-- editor/block-mover/style.scss | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/editor/block-mover/index.js b/editor/block-mover/index.js index 0082eae8a9fae..1a465f0c8f953 100644 --- a/editor/block-mover/index.js +++ b/editor/block-mover/index.js @@ -21,13 +21,13 @@ function BlockMover( { onMoveUp, onMoveDown, isFirst, isLast } ) { className="editor-block-mover__control" onClick={ onMoveUp } icon="arrow-up-alt2" - disabled={ isFirst } + aria-disabled={ isFirst } /> ); diff --git a/editor/block-mover/style.scss b/editor/block-mover/style.scss index a93bcef9c178e..a7b69706e7009 100644 --- a/editor/block-mover/style.scss +++ b/editor/block-mover/style.scss @@ -19,9 +19,10 @@ color: $dark-gray-900; } - &[disabled] { + &[aria-disabled="true"] { cursor: default; color: $light-gray-300; + pointer-events: none; } .dashicon { From 7c48392a256c56fa696af2b867a638317ef04669 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Fri, 12 May 2017 09:00:52 +0100 Subject: [PATCH 2/3] Editable: Auto-focus the link input --- blocks/editable/format-toolbar.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/blocks/editable/format-toolbar.js b/blocks/editable/format-toolbar.js index a91e9d0068642..990fb6c3adb91 100644 --- a/blocks/editable/format-toolbar.js +++ b/blocks/editable/format-toolbar.js @@ -124,6 +124,7 @@ class FormatToolbar extends wp.element.Component { } ); } + /* eslint-disable jsx-a11y/no-autofocus */ return (
@@ -134,6 +135,7 @@ class FormatToolbar extends wp.element.Component { style={ linkStyle } onSubmit={ this.submitLink }> ); + /* eslint-enable jsx-a11y/no-autofocus */ } } From fd2658f59e572d74b3e07f4dbb051df10f36a5c2 Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Fri, 12 May 2017 08:40:44 -0400 Subject: [PATCH 3/3] Unassign click handlers from disabled mover buttons --- editor/block-mover/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/editor/block-mover/index.js b/editor/block-mover/index.js index 1a465f0c8f953..3e3cb24ba8349 100644 --- a/editor/block-mover/index.js +++ b/editor/block-mover/index.js @@ -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 (