From a4680052760e52d051c758ea522397340f911fda Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 22 Feb 2015 20:13:31 +0000 Subject: [PATCH] Delegate `focusin` and `focusout` events for row actions to make sure the actions are always revealed on focus. props afercia. fixes #29765. git-svn-id: https://develop.svn.wordpress.org/trunk@31509 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/js/common.js | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/wp-admin/js/common.js b/src/wp-admin/js/common.js index bcdb576610..d672e0f2ca 100644 --- a/src/wp-admin/js/common.js +++ b/src/wp-admin/js/common.js @@ -442,17 +442,22 @@ $(document).ready( function() { }); // Show row actions on keyboard focus of its parent container element or any other elements contained within - $( 'td.post-title, td.title, td.comment, .tags td.column-name, .bookmarks td.column-name, td.blogname, td.username, .dashboard-comment-wrap' ).focusin(function(){ - clearTimeout( transitionTimeout ); - focusedRowActions = $(this).find( '.row-actions' ); - focusedRowActions.addClass( 'visible' ); - }).focusout(function(){ - // Tabbing between post title and .row-actions links needs a brief pause, otherwise - // the .row-actions div gets hidden in transit in some browsers (ahem, Firefox). - transitionTimeout = setTimeout(function(){ - focusedRowActions.removeClass( 'visible' ); - }, 30); - }); + $( '#wpbody-content' ).on({ + focusin: function() { + clearTimeout( transitionTimeout ); + focusedRowActions = $( this ).find( '.row-actions' ); + // transitionTimeout is necessary for Firefox, but Chrome won't remove the CSS class without a little help. + $( '.row-actions' ).not( this ).removeClass( 'visible' ); + focusedRowActions.addClass( 'visible' ); + }, + focusout: function() { + // Tabbing between post title and .row-actions links needs a brief pause, otherwise + // the .row-actions div gets hidden in transit in some browsers (ahem, Firefox). + transitionTimeout = setTimeout( function() { + focusedRowActions.removeClass( 'visible' ); + }, 30 ); + } + }, 'td.post-title, td.title, td.comment, .tags td.column-name, .bookmarks td.column-name, td.blogname, td.username, .dashboard-comment-wrap' ); $('#default-password-nag-no').click( function() { setUserSetting('default_password_nag', 'hide');