diff --git src/wp-includes/embed-template.php src/wp-includes/embed-template.php
index 120ae3b..e14e3aa 100644
|
|
if ( have_posts() ) : |
165 | 165 | </div> |
166 | 166 | </div> |
167 | 167 | </div> |
168 | | <div class="wp-embed-share-dialog hidden"> |
| 168 | <div class="wp-embed-share-dialog hidden" role="dialog" aria-label="<?php esc_attr_e( 'Sharing options' ); ?>"> |
169 | 169 | <div class="wp-embed-share-dialog-content"> |
170 | 170 | <div class="wp-embed-share-dialog-text"> |
171 | 171 | <ul class="wp-embed-share-tabs" role="tablist"> |
172 | | <li id="wp-embed-share-tab-button-wordpress" class="wp-embed-share-tab-button" role="presentation"> |
173 | | <button role="tab" aria-controls="wp-embed-share-tab-wordpress" aria-selected="true" tabindex="0"><?php esc_html_e( 'WordPress Embed' ); ?></button> |
| 172 | <li class="wp-embed-share-tab-button wp-embed-share-tab-button-wordpress" role="presentation"> |
| 173 | <button type="button" role="tab" aria-controls="wp-embed-share-tab-wordpress" aria-selected="true" tabindex="0"><?php esc_html_e( 'WordPress Embed' ); ?></button> |
174 | 174 | </li> |
175 | | <li id="wp-embed-share-tab-button-embed" class="wp-embed-share-tab-button" role="presentation"> |
176 | | <button role="tab" aria-controls="wp-embed-share-tab-html" aria-selected="false" tabindex="-1"><?php esc_html_e( 'HTML Embed' ); ?></button> |
| 175 | <li class="wp-embed-share-tab-button wp-embed-share-tab-button-html" role="presentation"> |
| 176 | <button type="button" role="tab" aria-controls="wp-embed-share-tab-html" aria-selected="false" tabindex="-1"><?php esc_html_e( 'HTML Embed' ); ?></button> |
177 | 177 | </li> |
178 | 178 | </ul> |
179 | | <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"> |
180 | | <input type="text" value="<?php the_permalink(); ?>" class="wp-embed-share-input" tabindex="0" readonly/> |
| 179 | <div id="wp-embed-share-tab-wordpress" class="wp-embed-share-tab" role="tabpanel" aria-hidden="false"> |
| 180 | <input type="text" value="<?php the_permalink(); ?>" class="wp-embed-share-input" aria-describedby="wp-embed-share-description-wordpress" tabindex="0" readonly /> |
181 | 181 | |
182 | | <p class="wp-embed-share-description"> |
| 182 | <p class="wp-embed-share-description" id="wp-embed-share-description-wordpress"> |
183 | 183 | <?php _e( 'Copy and paste this URL into your WordPress site to embed' ); ?> |
184 | 184 | </p> |
185 | 185 | </div> |
186 | | <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"> |
187 | | <textarea class="wp-embed-share-input" tabindex="0" readonly><?php echo esc_textarea( get_post_embed_html( null, 600, 400 ) ); ?></textarea> |
| 186 | <div id="wp-embed-share-tab-html" class="wp-embed-share-tab" role="tabpanel" aria-hidden="true"> |
| 187 | <textarea class="wp-embed-share-input" aria-describedby="wp-embed-share-description-html" tabindex="0" readonly><?php echo esc_textarea( get_post_embed_html( null, 600, 400 ) ); ?></textarea> |
188 | 188 | |
189 | | <p class="wp-embed-share-description"> |
| 189 | <p class="wp-embed-share-description" id="wp-embed-share-description-html"> |
190 | 190 | <?php _e( 'Copy and paste this code into your site to embed' ); ?> |
191 | 191 | </p> |
192 | 192 | </div> |
diff --git src/wp-includes/js/wp-embed-template.js src/wp-includes/js/wp-embed-template.js
index b1dc73a..6e7709f 100644
|
|
|
38 | 38 | |
39 | 39 | function openSharingDialog() { |
40 | 40 | share_dialog.className = share_dialog.className.replace( 'hidden', '' ); |
41 | | share_input[ 0 ].select(); |
| 41 | // Initial focus should go on the currently selected tab in the dialog. |
| 42 | document.querySelector( '.wp-embed-share-tab-button [aria-selected="true"]' ).focus(); |
42 | 43 | } |
43 | 44 | |
44 | 45 | function closeSharingDialog() { |
… |
… |
|
47 | 48 | } |
48 | 49 | |
49 | 50 | if ( share_dialog_open ) { |
50 | | share_dialog_open.addEventListener( 'click', function ( e ) { |
| 51 | share_dialog_open.addEventListener( 'click', function () { |
51 | 52 | openSharingDialog(); |
52 | | e.preventDefault(); |
53 | 53 | } ); |
54 | 54 | } |
55 | 55 | |
56 | 56 | if ( share_dialog_close ) { |
57 | | share_dialog_close.addEventListener( 'click', function ( e ) { |
| 57 | share_dialog_close.addEventListener( 'click', function () { |
58 | 58 | closeSharingDialog(); |
59 | | e.preventDefault(); |
60 | 59 | } ); |
61 | 60 | } |
62 | 61 | |
… |
… |
|
104 | 103 | if ( share_dialog_tabs ) { |
105 | 104 | for ( i = 0; i < share_dialog_tabs.length; i++ ) { |
106 | 105 | share_dialog_tabs[ i ].addEventListener( 'click', shareClickHandler ); |
107 | | |
108 | 106 | share_dialog_tabs[ i ].addEventListener( 'keydown', shareKeyHandler ); |
109 | 107 | } |
110 | 108 | } |
111 | 109 | |
112 | 110 | document.addEventListener( 'keydown', function ( e ) { |
113 | | if ( e.keyCode === 27 && -1 === share_dialog.className.indexOf( 'hidden' ) ) { |
| 111 | if ( 27 === e.keyCode && -1 === share_dialog.className.indexOf( 'hidden' ) ) { |
114 | 112 | closeSharingDialog(); |
| 113 | } else if ( 9 === e.keyCode ) { |
| 114 | constrainTabbing( e ); |
115 | 115 | } |
116 | 116 | }, false ); |
117 | 117 | |
| 118 | function constrainTabbing( e ) { |
| 119 | // Need to re-get the selected tab each time. |
| 120 | var firstFocusable = document.querySelector( '.wp-embed-share-tab-button [aria-selected="true"]' ); |
| 121 | |
| 122 | if ( share_dialog_close === e.target && ! e.shiftKey ) { |
| 123 | firstFocusable.focus(); |
| 124 | e.preventDefault(); |
| 125 | } else if ( firstFocusable === e.target && e.shiftKey ) { |
| 126 | share_dialog_close.focus(); |
| 127 | e.preventDefault(); |
| 128 | } |
| 129 | } |
| 130 | |
118 | 131 | if ( window.self === window.top ) { |
119 | 132 | return; |
120 | 133 | } |