Skip to content

Commit

Permalink
Arrow navigation in navigation mode
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed May 29, 2018
1 parent 8dfe428 commit 6283496
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions editor/components/writing-flow/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,16 +219,16 @@ class WritingFlow extends Component {

// In navigation mode, tab and arrows navigate from block to blocks
if ( keyboardMode === 'navigation' ) {
const navigateUp = keyCode === TAB && event.shiftKey;
const navigateDown = keyCode === TAB && ! event.shiftKey;
const navigateUp = ( keyCode === TAB && event.shiftKey ) || keyCode === UP;
const navigateDown = ( keyCode === TAB && ! event.shiftKey ) || keyCode === DOWN;

if ( ( navigateDown && nextBlockUid ) || ( navigateUp && previousBlockUid ) ) {
event.preventDefault();
this.moveSelection( navigateUp );
}

// Special case when reaching the end of the blocks (navigate to the next tabbable outside of the writing flow)
if ( navigateDown && selectedBlockUID && ! nextBlockUid ) {
if ( navigateDown && selectedBlockUID && ! nextBlockUid && [ UP, DOWN ].indexOf( keyCode ) === -1 ) {
this.props.clearSelectedBlock();
this.appender.focus();
}
Expand Down

0 comments on commit 6283496

Please sign in to comment.