Skip to content

Commit

Permalink
Avoid navigating outside the editor using the arrow keys
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Jul 27, 2017
1 parent b935bbf commit 9c348de
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion editor/modes/visual-editor/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,13 @@ class VisualEditorBlock extends Component {
const { keyCode, target } = event;
const moveUp = ( keyCode === UP || keyCode === LEFT );
const moveDown = ( keyCode === DOWN || keyCode === RIGHT );
const wrapperClassname = '.editor-visual-editor';
const selectors = [
'*[contenteditable="true"]',
'*[tabindex]',
'textarea',
'input',
].join( ',' );
].map( ( selector ) => `${ wrapperClassname } ${ selector }` ).join( ',' );

if ( moveUp || moveDown ) {
const selection = window.getSelection();
Expand Down

0 comments on commit 9c348de

Please sign in to comment.