Ticket #34484: 34484.patch
File 34484.patch, 5.3 KB (added by , 10 years ago) |
---|
-
src/wp-includes/embed-template.php
167 167 </div> 168 168 </div> 169 169 </div> 170 <div class="wp-embed-share-dialog hidden" >170 <div class="wp-embed-share-dialog hidden" role="dialog" aria-label="<?php esc_attr_e( 'Sharing options' ); ?>"> 171 171 <div class="wp-embed-share-dialog-content"> 172 172 <div class="wp-embed-share-dialog-text"> 173 173 <ul class="wp-embed-share-tabs" role="tablist"> 174 <li id="wp-embed-share-tab-button-wordpress"class="wp-embed-share-tab-button" role="presentation">175 <button role="tab" aria-controls="wp-embed-share-tab-wordpress" aria-selected="true" tabindex="0"><?php esc_html_e( 'WordPress Embed' ); ?></button>174 <li class="wp-embed-share-tab-button" role="presentation"> 175 <button type="button" role="tab" aria-controls="wp-embed-share-tab-wordpress" aria-selected="true" tabindex="0"><?php esc_html_e( 'WordPress Embed' ); ?></button> 176 176 </li> 177 <li id="wp-embed-share-tab-button-embed"class="wp-embed-share-tab-button" role="presentation">178 <button role="tab" aria-controls="wp-embed-share-tab-html" aria-selected="false" tabindex="-1"><?php esc_html_e( 'HTML Embed' ); ?></button>177 <li class="wp-embed-share-tab-button" role="presentation"> 178 <button type="button" role="tab" aria-controls="wp-embed-share-tab-html" aria-selected="false" tabindex="-1"><?php esc_html_e( 'HTML Embed' ); ?></button> 179 179 </li> 180 180 </ul> 181 <div id="wp-embed-share-tab-wordpress" class="wp-embed-share-tab" role="tabpanel" aria- labelledby="wp-embed-share-tab-button-wordpress" aria-hidden="false">182 <input type="text" value="<?php the_permalink(); ?>" class="wp-embed-share-input" tabindex="0" readonly/>181 <div id="wp-embed-share-tab-wordpress" class="wp-embed-share-tab" role="tabpanel" aria-hidden="false"> 182 <input type="text" value="<?php the_permalink(); ?>" class="wp-embed-share-input" aria-describedby="wp-embed-share-url-description" tabindex="0" readonly /> 183 183 184 <p class="wp-embed-share-description" >184 <p class="wp-embed-share-description" id="wp-embed-share-url-description"> 185 185 <?php _e( 'Copy and paste this URL into your WordPress site to embed' ); ?> 186 186 </p> 187 187 </div> 188 <div id="wp-embed-share-tab-html" class="wp-embed-share-tab" role="tabpanel" aria- labelledby="wp-embed-share-tab-button-html" aria-hidden="true">189 <textarea class="wp-embed-share-input" tabindex="0" readonly><?php echo esc_textarea( get_post_embed_html( null, 600, 400 ) ); ?></textarea>188 <div id="wp-embed-share-tab-html" class="wp-embed-share-tab" role="tabpanel" aria-hidden="true"> 189 <textarea class="wp-embed-share-input" aria-describedby="wp-embed-share-code-description" tabindex="0" readonly><?php echo esc_textarea( get_post_embed_html( null, 600, 400 ) ); ?></textarea> 190 190 191 <p class="wp-embed-share-description" >191 <p class="wp-embed-share-description" id="wp-embed-share-code-description"> 192 192 <?php _e( 'Copy and paste this code into your site to embed' ); ?> 193 193 </p> 194 194 </div> -
src/wp-includes/js/wp-embed-template.js
31 31 32 32 function openSharingDialog() { 33 33 share_dialog.className = share_dialog.className.replace( 'hidden', '' ); 34 share_input[ 0 ].select(); 34 // Initial focus should go on the currently selected tab in the dialog. 35 document.querySelector( '.wp-embed-share-tab-button [aria-selected="true"]' ).focus(); 35 36 } 36 37 37 38 function closeSharingDialog() { … … 40 41 } 41 42 42 43 if ( share_dialog_open ) { 43 share_dialog_open.addEventListener( 'click', function ( e) {44 share_dialog_open.addEventListener( 'click', function () { 44 45 openSharingDialog(); 45 e.preventDefault();46 46 } ); 47 47 } 48 48 49 49 if ( share_dialog_close ) { 50 share_dialog_close.addEventListener( 'click', function ( e) {50 share_dialog_close.addEventListener( 'click', function () { 51 51 closeSharingDialog(); 52 e.preventDefault();53 52 } ); 54 53 } 55 54 … … 97 96 if ( share_dialog_tabs ) { 98 97 for ( i = 0; i < share_dialog_tabs.length; i++ ) { 99 98 share_dialog_tabs[ i ].addEventListener( 'click', shareClickHandler ); 100 101 99 share_dialog_tabs[ i ].addEventListener( 'keydown', shareKeyHandler ); 102 100 } 103 101 } 104 102 105 103 document.addEventListener( 'keydown', function ( e ) { 106 if ( e.keyCode === 27&& -1 === share_dialog.className.indexOf( 'hidden' ) ) {104 if ( 27 === e.keyCode && -1 === share_dialog.className.indexOf( 'hidden' ) ) { 107 105 closeSharingDialog(); 106 } else if ( 9 === e.keyCode ) { 107 constrainTabbing( e ); 108 108 } 109 109 }, false ); 110 110 111 function constrainTabbing( e ) { 112 // Need to re-get each time the selected tab. 113 var firstFocusable = document.querySelector( '.wp-embed-share-tab-button [aria-selected="true"]' ); 114 115 if ( share_dialog_close === e.target && ! e.shiftKey ) { 116 firstFocusable.focus(); 117 e.preventDefault(); 118 } else if ( firstFocusable === e.target && e.shiftKey ) { 119 share_dialog_close.focus(); 120 e.preventDefault(); 121 } 122 } 123 111 124 if ( window.self === window.top ) { 112 125 return; 113 126 }