Skip to content

Commit 691faec

Browse files
committed
Blocks: Fix tab navigation
1 parent c507737 commit 691faec

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

blocks/library/quote/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ registerBlock( 'core/quote', {
4242

4343
edit( { attributes, setAttributes, focus, setFocus } ) {
4444
const { value, citation, style = 1 } = attributes;
45+
const focusedEditable = focus ? focus.editable || 'value' : null;
4546

4647
return (
4748
<blockquote className={ `blocks-quote blocks-quote-style-${ style }` }>
@@ -52,7 +53,7 @@ registerBlock( 'core/quote', {
5253
value: nextValue
5354
} )
5455
}
55-
focus={ focus && focus.editable === 'value' ? focus : null }
56+
focus={ focusedEditable === 'value' ? focus : null }
5657
onFocus={ () => setFocus( { editable: 'value' } ) }
5758
showAlignments
5859
/>
@@ -65,7 +66,7 @@ registerBlock( 'core/quote', {
6566
citation: nextCitation
6667
} )
6768
}
68-
focus={ focus && focus.editable === 'citation' ? focus : null }
69+
focus={ focusedEditable === 'citation' ? focus : null }
6970
onFocus={ () => setFocus( { editable: 'citation' } ) }
7071
/>
7172
</footer>

editor/modes/visual-editor/block.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,15 @@ class VisualEditorBlock extends wp.element.Component {
145145
<div
146146
ref={ this.bindBlockNode }
147147
onClick={ onSelect }
148+
onFocus={ onSelect }
148149
onBlur={ this.maybeDeselect }
149150
onKeyDown={ onStartTyping }
150151
onMouseEnter={ onHover }
151152
onMouseMove={ this.maybeHover }
152153
onMouseLeave={ onMouseLeave }
153154
className={ className }
154155
data-type={ block.blockType }
156+
tabIndex="0"
155157
{ ...wrapperProps }
156158
>
157159
{ ( ( isSelected && ! isTyping ) || isHovered ) && <BlockMover uid={ block.uid } /> }

0 commit comments

Comments
 (0)