Skip to content
This repository has been archived by the owner on Dec 17, 2021. It is now read-only.

Commit

Permalink
Correct tabbing on post edit screen.
Browse files Browse the repository at this point in the history
This fixes #23 and allows tabbing from the title to the subtitle and from the subtitle to the post content.
  • Loading branch information
kopepasah committed Aug 10, 2014
1 parent 87a0732 commit ed15f6a
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions admin/assets/js/subtitles.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,35 @@
prompt.removeClass( 'screen-reader-text' );
}
});

// Tab from the title to the subtitle, rather than the post content.
$( '#title' ).on( 'keydown', function( event ) {
if ( event.keyCode === 9 && ! event.ctrlKey && ! event.altKey && ! event.shiftKey ) {
$( '#subtitle' ).focus();

event.preventDefault();
}
});

// Tab from the subtitle directly to post content. Borrowed from post.js.
$( '#subtitle' ).on( 'keydown.editor-focus', function( event ) {
var editor, $textarea;

if ( event.keyCode === 9 && ! event.ctrlKey && ! event.altKey && ! event.shiftKey ) {
editor = typeof tinymce != 'undefined' && tinymce.get( 'content' );
$textarea = $( '#content' );

if ( editor && ! editor.isHidden() ) {
editor.focus();
} else if ( $textarea.length ) {
$textarea.focus();
} else {
return;
}

event.preventDefault();
}
});
});
}

Expand Down

0 comments on commit ed15f6a

Please sign in to comment.