Post locks: contain focus inside the dialog when tabbing, remove outline when focus is on the text, see #23697
git-svn-id: https://develop.svn.wordpress.org/trunk@23763 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c6bda62923
commit
9034f12b6b
|
@ -3411,6 +3411,7 @@ td.plugin-title p {
|
||||||
|
|
||||||
#notification-dialog .currently-editing {
|
#notification-dialog .currently-editing {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
|
outline: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1215,20 +1215,22 @@ function _admin_notice_post_locked() {
|
||||||
}
|
}
|
||||||
|
|
||||||
$preview_link = apply_filters( 'preview_post_link', $preview_link );
|
$preview_link = apply_filters( 'preview_post_link', $preview_link );
|
||||||
|
$override = apply_filters( 'override_post_lock', true, $post, $user );
|
||||||
|
$tab_last = $override ? '' : ' wp-tab-last';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div class="post-locked-message">
|
<div class="post-locked-message">
|
||||||
<div class="post-locked-avatar"><?php echo get_avatar( $user->ID, 64 ); ?></div>
|
<div class="post-locked-avatar"><?php echo get_avatar( $user->ID, 64 ); ?></div>
|
||||||
<p class="currently-editing" tabindex="0"><?php esc_html_e( sprintf( __( 'This content is currently locked. If you take over, %s will be blocked from continuing to edit.' ), $user->display_name ) ); ?></p>
|
<p class="currently-editing wp-tab-first" tabindex="0"><?php esc_html_e( sprintf( __( 'This content is currently locked. If you take over, %s will be blocked from continuing to edit.' ), $user->display_name ) ); ?></p>
|
||||||
<p>
|
<p>
|
||||||
<a class="button" href="<?php echo esc_url( wp_get_referer() ); ?>"><?php _e('Go back'); ?></a>
|
<a class="button" href="<?php echo esc_url( wp_get_referer() ); ?>"><?php _e('Go back'); ?></a>
|
||||||
<a class="button" href="<?php echo esc_url( $preview_link ); ?>"><?php _e('Preview'); ?></a>
|
<a class="button<?php echo $tab_last; ?>" href="<?php echo esc_url( $preview_link ); ?>"><?php _e('Preview'); ?></a>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Allow plugins to prevent some users overriding the post lock
|
// Allow plugins to prevent some users overriding the post lock
|
||||||
if ( apply_filters( 'override_post_lock', true, $post, $user ) ) {
|
if ( $override ) {
|
||||||
?>
|
?>
|
||||||
<a class="button button-primary" href="<?php echo esc_url( add_query_arg( 'get-post-lock', '1', get_edit_post_link( $post->ID, 'url' ) ) ); ?>"><?php _e('Take over'); ?></a>
|
<a class="button button-primary wp-tab-last" href="<?php echo esc_url( add_query_arg( 'get-post-lock', '1', get_edit_post_link( $post->ID, 'url' ) ) ); ?>"><?php _e('Take over'); ?></a>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1240,8 +1242,8 @@ function _admin_notice_post_locked() {
|
||||||
?>
|
?>
|
||||||
<div class="post-taken-over">
|
<div class="post-taken-over">
|
||||||
<div class="post-locked-avatar"></div>
|
<div class="post-locked-avatar"></div>
|
||||||
<p class="currently-editing" tabindex="0"></p>
|
<p class="currently-editing wp-tab-first" tabindex="0"></p>
|
||||||
<p><a class="button button-primary" href="<?php echo esc_url( admin_url('edit.php') ); ?>"><?php _e('Go to All Posts'); ?></a></p>
|
<p><a class="button button-primary wp-tab-last" href="<?php echo esc_url( admin_url('edit.php') ); ?>"><?php _e('Go to All Posts'); ?></a></p>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
|
@ -299,8 +299,21 @@ jQuery(document).ready( function($) {
|
||||||
|
|
||||||
postboxes.add_postbox_toggles(pagenow);
|
postboxes.add_postbox_toggles(pagenow);
|
||||||
|
|
||||||
// Post locks: if the Post Locked dialog is shown, focus it.
|
// Post locks: contain focus inside the dialog. If the dialog is shown, focus the first item.
|
||||||
$('#notification-dialog:visible').find('p.currently-editing').focus();
|
$('#notification-dialog').on( 'keydown', function(e) {
|
||||||
|
if ( e.which != 9 )
|
||||||
|
return;
|
||||||
|
|
||||||
|
var target = $(e.target);
|
||||||
|
|
||||||
|
if ( target.hasClass('wp-tab-first') && e.shiftKey ) {
|
||||||
|
$(this).find('.wp-tab-last').focus();
|
||||||
|
e.preventDefault();
|
||||||
|
} else if ( target.hasClass('wp-tab-last') && ! e.shiftKey ) {
|
||||||
|
$(this).find('.wp-tab-first').focus();
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
}).filter(':visible').find('.wp-tab-first').focus();
|
||||||
|
|
||||||
// multi-taxonomies
|
// multi-taxonomies
|
||||||
if ( $('#tagsdiv-post_tag').length ) {
|
if ( $('#tagsdiv-post_tag').length ) {
|
||||||
|
|
Loading…
Reference in New Issue