Fix tab button on the write screen in Opera, add tabindex to the menu, don't 'lock' the tab key between the title and the editor. Fixes #8197

git-svn-id: http://svn.automattic.com/wordpress/trunk@9784 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2008-11-19 12:02:28 +00:00
parent 4bff9364a3
commit ec0a4a9ebf
3 changed files with 14 additions and 13 deletions

View File

@ -236,7 +236,6 @@ showNotice = {
adminMenu = {
init : function() {
$('#adminmenu a').attr('tabindex', '10');
$('#adminmenu div.wp-menu-toggle').each( function() {
if ( $(this).siblings('.wp-submenu').length )
$(this).click(function(){ adminMenu.toggle( $(this).siblings('.wp-submenu') ); });

View File

@ -56,6 +56,7 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
$class[] = $item[4];
$class = $class ? ' class="' . join( ' ', $class ) . '"' : '';
$tabindex = ' tabindex="1"';
$id = isset($item[5]) && ! empty($item[5]) ? ' id="' . $item[5] . '"' : '';
$img = '';
if ( isset($item[6]) && ! empty($item[6]) ) {
@ -75,17 +76,17 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
$menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
if ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook)) {
$admin_is_parent = true;
echo "$img$toggle<a href='admin.php?page={$submenu[$item[2]][0][2]}'$class>{$item[0]}</a>";
echo "$img$toggle<a href='admin.php?page={$submenu[$item[2]][0][2]}'$class$tabindex>{$item[0]}</a>";
} else {
echo "\n\t$img$toggle<a href='{$submenu[$item[2]][0][2]}'$class>{$item[0]}</a>";
echo "\n\t$img$toggle<a href='{$submenu[$item[2]][0][2]}'$class$tabindex>{$item[0]}</a>";
}
} else if ( current_user_can($item[1]) ) {
$menu_hook = get_plugin_page_hook($item[2], 'admin.php');
if ( file_exists(WP_PLUGIN_DIR . "/{$item[2]}") || !empty($menu_hook) ) {
$admin_is_parent = true;
echo "\n\t$img$toggle<a href='admin.php?page={$item[2]}'$class>{$item[0]}</a>";
echo "\n\t$img$toggle<a href='admin.php?page={$item[2]}'$class$tabindex>{$item[0]}</a>";
} else {
echo "\n\t$img$toggle<a href='{$item[2]}'$class>{$item[0]}</a>";
echo "\n\t$img$toggle<a href='{$item[2]}'$class$tabindex>{$item[0]}</a>";
}
}
@ -118,13 +119,13 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
// If admin.php is the current page or if the parent exists as a file in the plugins or admin dir
$parent_exists = (!$admin_is_parent && file_exists(WP_PLUGIN_DIR . "/{$item[2]}") && !is_dir(WP_PLUGIN_DIR . "/{$item[2]}") ) || file_exists($item[2]);
if ( $parent_exists )
echo "<li$class><a href='{$item[2]}?page={$sub_item[2]}'$class>{$sub_item[0]}</a></li>";
echo "<li$class><a href='{$item[2]}?page={$sub_item[2]}'$class$tabindex>{$sub_item[0]}</a></li>";
elseif ( 'admin.php' == $pagenow || !$parent_exists )
echo "<li$class><a href='admin.php?page={$sub_item[2]}'$class>{$sub_item[0]}</a></li>";
echo "<li$class><a href='admin.php?page={$sub_item[2]}'$class$tabindex>{$sub_item[0]}</a></li>";
else
echo "<li$class><a href='{$item[2]}?page={$sub_item[2]}'$class>{$sub_item[0]}</a></li>";
echo "<li$class><a href='{$item[2]}?page={$sub_item[2]}'$class$tabindex>{$sub_item[0]}</a></li>";
} else {
echo "<li$class><a href='{$sub_item[2]}'$class>{$sub_item[0]}</a></li>";
echo "<li$class><a href='{$sub_item[2]}'$class$tabindex>{$sub_item[0]}</a></li>";
}
}
echo "</ul></div>";

View File

@ -1528,18 +1528,19 @@ function the_editor($content, $id = 'content', $prev_id = 'title', $media_button
// <![CDATA[
edCanvas = document.getElementById('<?php echo $id; ?>');
<?php if ( user_can_richedit() && $prev_id ) { ?>
var dotabkey = true;
// If tinyMCE is defined.
if ( typeof tinyMCE != 'undefined' ) {
// This code is meant to allow tabbing from Title to Post (TinyMCE).
jQuery('#<?php echo $prev_id; ?>').keydown(function (e) {
jQuery('#<?php echo $prev_id; ?>')[jQuery.browser.opera ? 'keypress' : 'keydown'](function (e) {
if (e.which == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
if ( (jQuery("#post_ID").val() < 1) && (jQuery("#title").val().length > 0) ) { autosave(); }
if ( tinyMCE.activeEditor && ! tinyMCE.activeEditor.isHidden() ) {
tinyMCE.activeEditor.focus();
if ( tinyMCE.activeEditor && ! tinyMCE.activeEditor.isHidden() && dotabkey ) {
e.preventDefault();
dotabkey = false;
tinyMCE.activeEditor.focus();
return false;
}
return;
}
});
}