diff --git a/src/js/_enqueues/admin/postbox.js b/src/js/_enqueues/admin/postbox.js
index 9789518b65..1eacaa8e53 100644
|
a
|
b
|
|
| 41 | 41 | var $el = $( this ), |
| 42 | 42 | p = $el.parent( '.postbox' ), |
| 43 | 43 | id = p.attr( 'id' ), |
| 44 | | ariaExpandedValue; |
| | 44 | ariaExpandedValue, |
| | 45 | closestPostbox = $( this ).closest( '.postbox' ); |
| 45 | 46 | |
| 46 | 47 | if ( 'dashboard_browser_nag' === id ) { |
| 47 | 48 | return; |
| 48 | 49 | } |
| 49 | 50 | |
| | 51 | if ( $el.hasClass( 'handle-order-prev' ) ) { |
| | 52 | // The handle order prev button was clicked. |
| | 53 | closestPostbox.prev().before( closestPostbox ); |
| | 54 | postboxes.save_order( postboxes.page ); |
| | 55 | $el.focus(); |
| | 56 | return; |
| | 57 | } |
| | 58 | |
| | 59 | if ( $el.hasClass( 'handle-order-next' ) ) { |
| | 60 | // The handle order next button was clicked. |
| | 61 | closestPostbox.next().after( closestPostbox ); |
| | 62 | postboxes.save_order( postboxes.page ); |
| | 63 | $el.focus(); |
| | 64 | return; |
| | 65 | } |
| | 66 | |
| 50 | 67 | p.toggleClass( 'closed' ); |
| 51 | 68 | |
| 52 | 69 | ariaExpandedValue = ! p.hasClass( 'closed' ); |
| … |
… |
|
| 99 | 116 | * @return {void} |
| 100 | 117 | */ |
| 101 | 118 | add_postbox_toggles : function (page, args) { |
| 102 | | var $handles = $( '.postbox .hndle, .postbox .handlediv' ); |
| | 119 | var $handles = $( '.postbox .hndle, .postbox .handlediv, .postbox .handle-order-next, .postbox .handle-order-prev' ); |
| 103 | 120 | |
| 104 | 121 | this.page = page; |
| 105 | 122 | this.init( page, args ); |
| … |
… |
|
| 263 | 280 | var $el = $( this ); |
| 264 | 281 | $el.attr( 'aria-expanded', ! $el.parent( '.postbox' ).hasClass( 'closed' ) ); |
| 265 | 282 | }); |
| | 283 | |
| | 284 | // Handle the click & keyup events for focusing properly the postboxes. |
| | 285 | $( 'body' ).on( 'click', function( e ) { |
| | 286 | var target = $( e.target ); |
| | 287 | |
| | 288 | $( '.postbox' ).each( function() { |
| | 289 | $( this ).removeClass( 'focused' ); |
| | 290 | }); |
| | 291 | |
| | 292 | if ( 1 === $( target ).closest( '.postbox' ).length ) { |
| | 293 | target.closest( '.postbox' ).addClass( 'focused' ); |
| | 294 | } |
| | 295 | }); |
| | 296 | |
| | 297 | $( 'body' ).on( 'keyup', function( e ) { |
| | 298 | var keyCode = e.keyCode || e.which; |
| | 299 | |
| | 300 | // We only need to check on a Tab keyup. |
| | 301 | if (keyCode == 9) { |
| | 302 | var target = $( e.target ); |
| | 303 | |
| | 304 | $( '.postbox' ).each( function() { |
| | 305 | $( this ).removeClass( 'focused' ); |
| | 306 | }); |
| | 307 | |
| | 308 | if ( 1 === $( target ).closest( '.postbox' ).length ) { |
| | 309 | target.closest( '.postbox' ).addClass( 'focused' ); |
| | 310 | } |
| | 311 | } |
| | 312 | }); |
| 266 | 313 | }, |
| 267 | 314 | |
| 268 | 315 | /** |
diff --git a/src/wp-admin/css/common.css b/src/wp-admin/css/common.css
index a8b8112b00..c3196497bf 100644
|
a
|
b
|
html.wp-toolbar { |
| 2057 | 2057 | font-weight: 400; |
| 2058 | 2058 | } |
| 2059 | 2059 | |
| | 2060 | .postbox .handle-order-prev, |
| | 2061 | .postbox .handle-order-next, |
| 2060 | 2062 | .postbox .handlediv { |
| 2061 | 2063 | display: none; |
| 2062 | 2064 | float: right; |
| … |
… |
html.wp-toolbar { |
| 2069 | 2071 | cursor: pointer; |
| 2070 | 2072 | } |
| 2071 | 2073 | |
| | 2074 | .postbox .handle-order-prev, |
| | 2075 | .postbox .handle-order-next, |
| 2072 | 2076 | .js .postbox .handlediv { |
| 2073 | | display: block; |
| | 2077 | display: inline-block; |
| 2074 | 2078 | } |
| 2075 | 2079 | |
| 2076 | 2080 | .sortable-placeholder { |
| … |
… |
html.wp-toolbar { |
| 2085 | 2089 | line-height: 1; |
| 2086 | 2090 | } |
| 2087 | 2091 | |
| | 2092 | .postbox.focused { |
| | 2093 | box-shadow: |
| | 2094 | 0 0 0 1px #5b9dd9, |
| | 2095 | 0 0 2px 1px rgba(30, 140, 190, 0.8); |
| | 2096 | } |
| | 2097 | |
| 2088 | 2098 | /* user-select is not a part of the CSS standard - may change behavior in the future */ |
| 2089 | 2099 | .postbox .hndle, |
| 2090 | 2100 | .stuffbox .hndle { |
| … |
… |
img { |
| 3048 | 3058 | content: "\f140"; |
| 3049 | 3059 | } |
| 3050 | 3060 | |
| | 3061 | .js .postbox .handle-order-next .toggle-indicator:before { |
| | 3062 | content: "\f347"; |
| | 3063 | } |
| | 3064 | |
| | 3065 | .js .postbox .handle-order-prev .toggle-indicator:before { |
| | 3066 | content: "\f343"; |
| | 3067 | } |
| | 3068 | |
| | 3069 | .js .postbox .handle-order-next .toggle-indicator:before, |
| | 3070 | .js .postbox .handle-order-prev .toggle-indicator:before, |
| 3051 | 3071 | .js .postbox .handlediv .toggle-indicator:before { |
| 3052 | 3072 | margin-top: 4px; |
| 3053 | 3073 | width: 20px; |
| … |
… |
img { |
| 3055 | 3075 | text-indent: -1px; /* account for the dashicon alignment */ |
| 3056 | 3076 | } |
| 3057 | 3077 | |
| | 3078 | .rtl.js .postbox .handle-order-next .toggle-indicator:before, |
| | 3079 | .rtl.js .postbox .handle-order-prev .toggle-indicator:before, |
| 3058 | 3080 | .rtl.js .postbox .handlediv .toggle-indicator:before { |
| 3059 | 3081 | text-indent: 1px; /* account for the dashicon alignment */ |
| 3060 | 3082 | } |
| … |
… |
img { |
| 3065 | 3087 | color: #72777c; |
| 3066 | 3088 | } |
| 3067 | 3089 | |
| | 3090 | .js .postbox .handle-order-next:focus, |
| | 3091 | .js .postbox .handle-order-prev:focus, |
| 3068 | 3092 | .js .postbox .handlediv:focus { |
| 3069 | 3093 | box-shadow: none; |
| 3070 | 3094 | outline: none; |
| 3071 | 3095 | } |
| 3072 | 3096 | |
| | 3097 | .js .postbox .handle-order-next:focus .toggle-indicator:before, |
| | 3098 | .js .postbox .handle-order-prev:focus .toggle-indicator:before, |
| 3073 | 3099 | .js .postbox .handlediv:focus .toggle-indicator:before { |
| 3074 | 3100 | box-shadow: |
| 3075 | 3101 | 0 0 0 1px #5b9dd9, |
diff --git a/src/wp-admin/includes/template.php b/src/wp-admin/includes/template.php
index 5e6838eab1..9257d803d3 100644
|
a
|
b
|
function do_meta_boxes( $screen, $context, $object ) { |
| 1315 | 1315 | ) . '</span>'; |
| 1316 | 1316 | echo '<span class="toggle-indicator" aria-hidden="true"></span>'; |
| 1317 | 1317 | echo '</button>'; |
| | 1318 | |
| | 1319 | echo '<button type="button" class="handle-order-next">'; |
| | 1320 | echo '<span class="screen-reader-text">' . sprintf( |
| | 1321 | /* translators: Meta box title. */ |
| | 1322 | __( 'Move %s panel to next position' ), |
| | 1323 | $widget_title |
| | 1324 | ) . '</span>'; |
| | 1325 | echo '<span class="toggle-indicator" aria-hidden="true"></span>'; |
| | 1326 | echo '</button>'; |
| | 1327 | |
| | 1328 | echo '<button type="button" class="handle-order-prev">'; |
| | 1329 | echo '<span class="screen-reader-text">' . sprintf( |
| | 1330 | /* translators: Meta box title. */ |
| | 1331 | __( 'Move %s panel to previous position' ), |
| | 1332 | $widget_title |
| | 1333 | ) . '</span>'; |
| | 1334 | echo '<span class="toggle-indicator" aria-hidden="true"></span>'; |
| | 1335 | echo '</button>'; |
| 1318 | 1336 | } |
| 1319 | 1337 | echo '<h2 class="hndle">'; |
| 1320 | 1338 | if ( 'dashboard_php_nag' === $box['id'] ) { |