From 59ab1f6366a5ddf0c27adf787588d2b5f3eed0ff Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Wed, 19 Nov 2008 12:02:28 +0000 Subject: [PATCH] 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: https://develop.svn.wordpress.org/trunk@9784 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/js/common.js | 1 - wp-admin/menu-header.php | 17 +++++++++-------- wp-includes/general-template.php | 9 +++++---- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/wp-admin/js/common.js b/wp-admin/js/common.js index 24dca37ffa..08fb3921b5 100644 --- a/wp-admin/js/common.js +++ b/wp-admin/js/common.js @@ -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') ); }); diff --git a/wp-admin/menu-header.php b/wp-admin/menu-header.php index 5321a32b55..dc9935bef6 100644 --- a/wp-admin/menu-header.php +++ b/wp-admin/menu-header.php @@ -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{$item[0]}"; + echo "$img$toggle{$item[0]}"; } else { - echo "\n\t$img$toggle{$item[0]}"; + echo "\n\t$img$toggle{$item[0]}"; } } 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{$item[0]}"; + echo "\n\t$img$toggle{$item[0]}"; } else { - echo "\n\t$img$toggle{$item[0]}"; + echo "\n\t$img$toggle{$item[0]}"; } } @@ -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 "{$sub_item[0]}"; + echo "{$sub_item[0]}"; elseif ( 'admin.php' == $pagenow || !$parent_exists ) - echo "{$sub_item[0]}"; + echo "{$sub_item[0]}"; else - echo "{$sub_item[0]}"; + echo "{$sub_item[0]}"; } else { - echo "{$sub_item[0]}"; + echo "{$sub_item[0]}"; } } echo ""; diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index ccb572ba0b..14f5c5f568 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -1528,18 +1528,19 @@ function the_editor($content, $id = 'content', $prev_id = 'title', $media_button // '); + var dotabkey = true; // If tinyMCE is defined. if ( typeof tinyMCE != 'undefined' ) { // This code is meant to allow tabbing from Title to Post (TinyMCE). - jQuery('#').keydown(function (e) { + jQuery('#')[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; } }); }