Skip to content

Commit

Permalink
Block: Move tabIndex to wrapper component
Browse files Browse the repository at this point in the history
See: #2934
See: https://codepen.io/aduth/pen/MQxRME

Something needs to capture the focus event, which is skipped by button press on the block's toolbar, but bubbles up wrongly to the parent's edit wrapper (which has tabIndex) and causes parent block to select itself.
  • Loading branch information
aduth committed Mar 2, 2018
1 parent 02a1aa8 commit eef08f7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion components/toolbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ function Toolbar( { controls = [], children, className } ) {
<div
key={ [ setIndex, controlIndex ].join() }
className={ setIndex > 0 && controlIndex === 0 ? 'has-left-divider' : null }
tabIndex={ -1 }
>
<IconButton
icon={ control.icon }
Expand Down
2 changes: 1 addition & 1 deletion editor/components/block-list/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ export class BlockListBlock extends Component {
data-type={ block.name }
onTouchStart={ this.onTouchStart }
onClick={ this.onClick }
tabIndex="0"
childHandledEvents={ [
'onKeyPress',
'onDragStart',
Expand Down Expand Up @@ -619,7 +620,6 @@ export class BlockListBlock extends Component {
onKeyDown={ this.onKeyDown }
onFocus={ this.onFocus }
className={ BlockListBlock.className }
tabIndex="0"
aria-label={ blockLabel }
data-block={ block.uid }
>
Expand Down

0 comments on commit eef08f7

Please sign in to comment.