Make post meta box toggles accessible.

props joedolson.
fixes #33544.

git-svn-id: https://develop.svn.wordpress.org/trunk@33762 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2015-08-26 15:22:57 +00:00
parent 46d0feea46
commit a69c9ff66f
3 changed files with 12 additions and 6 deletions

View File

@ -1788,8 +1788,8 @@ html.wp-toolbar {
.postbox .handlediv {
float: right;
width: 27px;
height: 30px;
width: 33px;
height: 36px;
}
.js .postbox .handlediv {

View File

@ -1083,8 +1083,11 @@ function do_meta_boxes( $screen, $context, $object ) {
$i++;
$hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : '';
echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
if ( 'dashboard_browser_nag' != $box['id'] )
echo '<div class="handlediv" title="' . esc_attr__('Click to toggle') . '"><br /></div>';
if ( 'dashboard_browser_nag' != $box['id'] ) {
echo '<button class="handlediv button-link" title="' . esc_attr__( 'Click to toggle' ) . '" aria-expanded="true">';
echo '<span class="screen-reader-text">' . sprintf( __( 'Click to toggle %s panel' ), $box['title'] ) . '</span><br />';
echo '</button>';
}
echo "<h3 class='hndle'><span>{$box['title']}</span></h3>\n";
echo '<div class="inside">' . "\n";
call_user_func($box['callback'], $object, $box);

View File

@ -11,13 +11,16 @@ var postboxes;
self.init(page, args);
$('.postbox .hndle, .postbox .handlediv').bind('click.postboxes', function() {
$('.postbox .hndle, .postbox .handlediv').bind('click.postboxes', function( e ) {
var p = $(this).parent('.postbox'), id = p.attr('id');
if ( 'dashboard_browser_nag' == id )
return;
p.toggleClass('closed');
e.preventDefault();
p.toggleClass( 'closed' );
$(this).attr( 'aria-expanded', ! p.hasClass( 'closed' ) );
if ( page != 'press-this' )
self.save_state(page);