Changeset 41586
- Timestamp:
- 09/24/2017 03:59:56 PM (7 years ago)
- Location:
- trunk/src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/common.css
r41560 r41586 3036 3036 } 3037 3037 3038 #template label { 3039 display: inline-block; 3040 margin-bottom: 1em; 3041 font-weight: 600; 3042 } 3043 3038 3044 /* rtl:ignore */ 3039 3045 #template textarea, -
trunk/src/wp-admin/css/customize-controls.css
r41558 r41586 551 551 margin-bottom: 0; 552 552 } 553 553 554 .customize-section-description ul { 554 555 margin-left: 1em; 555 556 } 557 556 558 .customize-section-description ul > li { 557 559 list-style: disc; 558 560 } 561 559 562 .section-description-buttons { 560 563 text-align: right; … … 1198 1201 } 1199 1202 1203 .customize-section-description-container + #customize-control-custom_css .customize-control-title { 1204 margin-left: 12px; 1205 } 1206 1200 1207 .customize-section-description-container + #customize-control-custom_css:last-child textarea { 1201 1208 border-right: 0; … … 1204 1211 resize: none; 1205 1212 } 1213 1206 1214 .customize-section-description-container + #customize-control-custom_css:last-child { 1207 1215 margin-left: -12px; … … 1214 1222 height: calc( 100vh - 185px ); 1215 1223 } 1224 1216 1225 .CodeMirror-lint-tooltip, 1217 1226 .CodeMirror-hints { … … 1228 1237 margin-right: 0; 1229 1238 } 1239 1230 1240 .customize-section-description-container + #customize-control-custom_css:last-child textarea { 1231 1241 height: calc( 100vh - 140px ); -
trunk/src/wp-admin/js/customize-controls.js
r41582 r41586 1177 1177 content.toggleClass( 'open' ); 1178 1178 content.slideToggle(); 1179 content.attr( 'aria-expanded', function( i, attr ) {1179 $( this ).attr( 'aria-expanded', function( i, attr ) { 1180 1180 return 'true' === attr ? 'false' : 'true'; 1181 1181 }); … … 1889 1889 meta = panel.container.find( '.panel-meta:first' ); 1890 1890 1891 meta.find( '> .accordion-section-title .customize-help-toggle' ).on( 'click keydown', function( event ) { 1892 if ( api.utils.isKeydownButNotEnterEvent( event ) ) { 1893 return; 1894 } 1895 event.preventDefault(); // Keep this AFTER the key filter above 1896 1891 meta.find( '> .accordion-section-title .customize-help-toggle' ).on( 'click', function() { 1897 1892 if ( meta.hasClass( 'cannot-expand' ) ) { 1898 1893 return; … … 3781 3776 3782 3777 control.editor = wp.codeEditor.initialize( $textarea, settings ); 3778 3779 // Improve the editor accessibility. 3780 $( control.editor.codemirror.display.lineDiv ) 3781 .attr({ 3782 role: 'textbox', 3783 'aria-multiline': 'true', 3784 'aria-label': control.params.label, 3785 'aria-describedby': 'editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4' 3786 }); 3787 3788 // Focus the editor when clicking on its label. 3789 control.container.find( 'label' ).on( 'click', function() { 3790 control.editor.codemirror.focus(); 3791 }); 3783 3792 3784 3793 /* … … 5969 5978 }); 5970 5979 5971 // Set up the section des ription behaviors.5980 // Set up the section description behaviors. 5972 5981 sectionReady.done( function setupSectionDescription( section ) { 5973 5982 var control = api.control( 'custom_css' ); … … 5977 5986 section.container.find( '.section-meta .customize-section-description:first' ) 5978 5987 .removeClass( 'open' ) 5979 .slideUp() 5980 .attr( 'aria-expanded', 'false' ); 5988 .slideUp(); 5989 5990 section.container.find( '.customize-help-toggle' ) 5991 .attr( 'aria-expanded', 'false' ) 5992 .focus(); // Avoid focus loss. 5981 5993 }); 5982 5994 … … 5985 5997 section.container.find( '.section-meta .customize-section-description:first' ) 5986 5998 .addClass( 'open' ) 5987 .show() 5988 .attr( 'aria-expanded', 'true' ); 5999 .show(); 6000 6001 section.container.find( '.customize-help-toggle' ).attr( 'aria-expanded', 'true' ); 5989 6002 } 5990 6003 }); -
trunk/src/wp-admin/js/theme-plugin-editor.js
r41376 r41586 84 84 editor = wp.codeEditor.initialize( $( '#newcontent' ), codeEditorSettings ); 85 85 86 // Improve the editor accessibility. 87 $( editor.codemirror.display.lineDiv ) 88 .attr({ 89 role: 'textbox', 90 'aria-multiline': 'true', 91 'aria-labelledby': 'theme-plugin-editor-label', 92 'aria-describedby': 'editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4' 93 }); 94 95 // Focus the editor when clicking on its label. 96 $( '#theme-plugin-editor-label' ).on( 'click', function() { 97 editor.codemirror.focus(); 98 }); 99 86 100 component.instance = editor; 87 101 }; -
trunk/src/wp-admin/js/widgets/custom-html-widgets.js
r41376 r41586 211 211 212 212 control.editor = wp.codeEditor.initialize( control.fields.content, settings ); 213 214 // Improve the editor accessibility. 215 $( control.editor.codemirror.display.lineDiv ) 216 .attr({ 217 role: 'textbox', 218 'aria-multiline': 'true', 219 'aria-labelledby': control.fields.content[0].id + '-label', 220 'aria-describedby': 'editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4' 221 }); 222 223 // Focus the editor when clicking on its label. 224 $( '#' + control.fields.content[0].id + '-label' ).on( 'click', function() { 225 control.editor.codemirror.focus(); 226 }); 227 213 228 control.fields.content.on( 'change', function() { 214 229 if ( this.value !== control.editor.codemirror.getValue() ) { -
trunk/src/wp-admin/plugin-editor.php
r41560 r41586 196 196 '<p>' . __('Choose a plugin to edit from the dropdown menu and click the Select button. Click once on any file name to load it in the editor, and make your changes. Don’t forget to save your changes (Update File) when you’re finished.') . '</p>' . 197 197 '<p>' . __('The Documentation menu below the editor lists the PHP functions recognized in the plugin file. Clicking Look Up takes you to a web page about that particular function.') . '</p>' . 198 '<p id="newcontent-description">' . __( 'In the editing area the Tab key enters a tab character. To move below this area by pressing Tab, press the Esc key followed by the Tab key. In some cases the Esc key will need to be pressed twice before the Tab key will allow you to continue.' ) . '</p>' . 198 '<p id="editor-keyboard-trap-help-1">' . __( 'When using a keyboard to navigate:' ) . '</p>' . 199 '<ul>' . 200 '<li id="editor-keyboard-trap-help-2">' . __( 'In the editing area, the Tab key enters a tab character.' ) . '</li>' . 201 '<li id="editor-keyboard-trap-help-3">' . __( 'To move away from this area, press the Esc key followed by the Tab key.' ) . '</li>' . 202 '<li id="editor-keyboard-trap-help-4">' . __( 'Screen reader users: when in forms mode, you may need to press the Esc key twice.' ) . '</li>' . 203 '</ul>' . 199 204 '<p>' . __('If you want to make changes but don’t want them to be overwritten when the plugin is updated, you may be ready to think about writing your own plugin. For information on how to edit plugins, write your own from scratch, or just better understand their anatomy, check out the links below.') . '</p>' . 200 205 ( is_network_admin() ? '<p>' . __('Any edits to files from this screen will be reflected on all sites in the network.') . '</p>' : '' ) … … 256 261 <div class="fileedit-sub"> 257 262 <div class="alignleft"> 258 <big><?php 263 <h2> 264 <?php 259 265 if ( is_plugin_active( $plugin ) ) { 260 266 if ( is_writeable( $real_file ) ) { … … 274 280 } 275 281 } 276 ?></big> 282 ?> 283 </h2> 277 284 </div> 278 285 <div class="alignright"> … … 322 329 <form name="template" id="template" action="plugin-editor.php" method="post"> 323 330 <?php wp_nonce_field('edit-plugin_' . $file) ?> 324 <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" aria-describedby="newcontent-description"><?php echo $content; ?></textarea> 325 <input type="hidden" name="action" value="update" /> 326 <input type="hidden" name="file" value="<?php echo esc_attr($file) ?>" /> 327 <input type="hidden" name="plugin" value="<?php echo esc_attr($plugin) ?>" /> 328 <input type="hidden" name="scrollto" id="scrollto" value="<?php echo $scrollto; ?>" /> 331 <div> 332 <label for="newcontent" id="theme-plugin-editor-label"><?php _e( 'Selected file content:' ); ?></label> 333 <textarea cols="70" rows="25" name="newcontent" id="newcontent" aria-describedby="editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4"><?php echo $content; ?></textarea> 334 <input type="hidden" name="action" value="update" /> 335 <input type="hidden" name="file" value="<?php echo esc_attr( $file ); ?>" /> 336 <input type="hidden" name="plugin" value="<?php echo esc_attr( $plugin ); ?>" /> 337 <input type="hidden" name="scrollto" id="scrollto" value="<?php echo esc_attr( $scrollto ); ?>" /> 329 338 </div> 330 339 <?php if ( !empty( $docs_select ) ) : ?> -
trunk/src/wp-admin/theme-editor.php
r41399 r41586 25 25 'title' => __('Overview'), 26 26 'content' => 27 '<p>' . __('You can use the Theme Editor to edit the individual CSS and PHP files which make up your theme.') . '</p> 28 <p>' . __( 'Begin by choosing a theme to edit from the dropdown menu and clicking the Select button. A list then appears of the theme’s template files. Clicking once on any file name causes the file to appear in the large Editor box.' ) . '</p> 29 <p>' . __('For PHP files, you can use the Documentation dropdown to select from functions recognized in that file. Look Up takes you to a web page with reference material about that particular function.') . '</p> 30 <p id="newcontent-description">' . __( 'In the editing area the Tab key enters a tab character. To move below this area by pressing Tab, press the Esc key followed by the Tab key. In some cases the Esc key will need to be pressed twice before the Tab key will allow you to continue.' ) . '</p> 31 <p>' . __('After typing in your edits, click Update File.') . '</p> 32 <p>' . __('<strong>Advice:</strong> think very carefully about your site crashing if you are live-editing the theme currently in use.') . '</p> 33 <p>' . sprintf( __('Upgrading to a newer version of the same theme will override changes made here. To avoid this, consider creating a <a href="%s">child theme</a> instead.'), __('https://codex.wordpress.org/Child_Themes') ) . '</p>' . 34 ( is_network_admin() ? '<p>' . __('Any edits to files from this screen will be reflected on all sites in the network.') . '</p>' : '' ) 27 '<p>' . __( 'You can use the Theme Editor to edit the individual CSS and PHP files which make up your theme.' ) . '</p>' . 28 '<p>' . __( 'Begin by choosing a theme to edit from the dropdown menu and clicking the Select button. A list then appears of the theme’s template files. Clicking once on any file name causes the file to appear in the large Editor box.' ) . '</p>' . 29 '<p>' . __( 'For PHP files, you can use the Documentation dropdown to select from functions recognized in that file. Look Up takes you to a web page with reference material about that particular function.' ) . '</p>' . 30 '<p id="editor-keyboard-trap-help-1">' . __( 'When using a keyboard to navigate:' ) . '</p>' . 31 '<ul>' . 32 '<li id="editor-keyboard-trap-help-2">' . __( 'In the editing area, the Tab key enters a tab character.' ) . '</li>' . 33 '<li id="editor-keyboard-trap-help-3">' . __( 'To move away from this area, press the Esc key followed by the Tab key.' ) . '</li>' . 34 '<li id="editor-keyboard-trap-help-4">' . __( 'Screen reader users: when in forms mode, you may need to press the Esc key twice.' ) . '</li>' . 35 '</ul>' . 36 '<p>' . __( 'After typing in your edits, click Update File.' ) . '</p>' . 37 '<p>' . __( '<strong>Advice:</strong> think very carefully about your site crashing if you are live-editing the theme currently in use.' ) . '</p>' . 38 /* translators: placeholder is link to codex article about child themes */ 39 '<p>' . sprintf( __( 'Upgrading to a newer version of the same theme will override changes made here. To avoid this, consider creating a <a href="%s">child theme</a> instead.' ), __( 'https://codex.wordpress.org/Child_Themes' ) ) . '</p>' . 40 ( is_network_admin() ? '<p>' . __( 'Any edits to files from this screen will be reflected on all sites in the network.' ) . '</p>' : '' ), 35 41 ) ); 36 42 … … 295 301 <form name="template" id="template" action="theme-editor.php" method="post"> 296 302 <?php wp_nonce_field( 'edit-theme_' . $file . $stylesheet ); ?> 297 <div><textarea cols="70" rows="30" name="newcontent" id="newcontent" aria-describedby="newcontent-description"><?php echo $content; ?></textarea> 298 <input type="hidden" name="action" value="update" /> 299 <input type="hidden" name="file" value="<?php echo esc_attr( $relative_file ); ?>" /> 300 <input type="hidden" name="theme" value="<?php echo esc_attr( $theme->get_stylesheet() ); ?>" /> 301 <input type="hidden" name="scrollto" id="scrollto" value="<?php echo $scrollto; ?>" /> 303 <div> 304 <label for="newcontent" id="theme-plugin-editor-label"><?php _e( 'Selected file content:' ); ?></label> 305 <textarea cols="70" rows="30" name="newcontent" id="newcontent" aria-describedby="editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4"><?php echo $content; ?></textarea> 306 <input type="hidden" name="action" value="update" /> 307 <input type="hidden" name="file" value="<?php echo esc_attr( $relative_file ); ?>" /> 308 <input type="hidden" name="theme" value="<?php echo esc_attr( $theme->get_stylesheet() ); ?>" /> 309 <input type="hidden" name="scrollto" id="scrollto" value="<?php echo esc_attr( $scrollto ); ?>" /> 302 310 </div> 303 311 <?php if ( ! empty( $functions ) ) : ?> -
trunk/src/wp-includes/class-wp-customize-manager.php
r41558 r41586 4169 4169 /* Custom CSS */ 4170 4170 $section_description = '<p>'; 4171 $section_description .= __( 'Add your own CSS code here to customize the appearance and layout of your site.' , 'better-code-editing');4171 $section_description .= __( 'Add your own CSS code here to customize the appearance and layout of your site.' ); 4172 4172 $section_description .= sprintf( 4173 4173 ' <a href="%1$s" class="external-link" target="_blank">%2$s<span class="screen-reader-text">%3$s</span></a>', 4174 esc_url( __( 'https://codex.wordpress.org/CSS' , 'default') ),4175 __( 'Learn more about CSS' , 'default'),4174 esc_url( __( 'https://codex.wordpress.org/CSS' ) ), 4175 __( 'Learn more about CSS' ), 4176 4176 /* translators: accessibility text */ 4177 __( '(opens in a new window)' , 'default')4177 __( '(opens in a new window)' ) 4178 4178 ); 4179 4179 $section_description .= '</p>'; 4180 4180 4181 $section_description .= '<p >' . __( 'When using a keyboard to navigate:', 'better-code-editing' ) . '</p>';4181 $section_description .= '<p id="editor-keyboard-trap-help-1">' . __( 'When using a keyboard to navigate:' ) . '</p>'; 4182 4182 $section_description .= '<ul>'; 4183 $section_description .= '<li>' . __( 'In the CSS edit field, Tab enters a tab character.', 'better-code-editing' ) . '</li>'; 4184 $section_description .= '<li>' . __( 'To move keyboard focus, press Esc then Tab for the next element, or Esc then Shift+Tab for the previous element.', 'better-code-editing' ) . '</li>'; 4183 $section_description .= '<li id="editor-keyboard-trap-help-2">' . __( 'In the editing area, the Tab key enters a tab character.' ) . '</li>'; 4184 $section_description .= '<li id="editor-keyboard-trap-help-3">' . __( 'To move away from this area, press the Esc key followed by the Tab key.' ) . '</li>'; 4185 $section_description .= '<li id="editor-keyboard-trap-help-4">' . __( 'Screen reader users: when in forms mode, you may need to press the Esc key twice.' ) . '</li>'; 4185 4186 $section_description .= '</ul>'; 4186 4187 … … 4189 4190 $section_description .= sprintf( 4190 4191 /* translators: placeholder is link to user profile */ 4191 __( 'The edit field automatically highlights code syntax. You can disable this in your %s to work in plain text mode.' , 'better-code-editing'),4192 __( 'The edit field automatically highlights code syntax. You can disable this in your %s to work in plain text mode.' ), 4192 4193 sprintf( 4193 4194 ' <a href="%1$s" class="external-link" target="_blank">%2$s<span class="screen-reader-text">%3$s</span></a>', 4194 esc_url( get_edit_profile_url() . '#syntax_highlighting'),4195 __( 'user profile' , 'better-code-editing'),4195 esc_url( get_edit_profile_url() ), 4196 __( 'user profile' ), 4196 4197 /* translators: accessibility text */ 4197 __( '(opens in a new window)' , 'default')4198 __( '(opens in a new window)' ) 4198 4199 ) 4199 4200 ); … … 4202 4203 4203 4204 $section_description .= '<p class="section-description-buttons">'; 4204 $section_description .= '<button type="button" class="button-link section-description-close">' . __( 'Close' , 'default') . '</button>';4205 $section_description .= '<button type="button" class="button-link section-description-close">' . __( 'Close' ) . '</button>'; 4205 4206 $section_description .= '</p>'; 4206 4207 … … 4219 4220 4220 4221 $this->add_control( new WP_Customize_Code_Editor_Control( $this, 'custom_css', array( 4221 'section' => 'custom_css', 4222 'settings' => array( 'default' => $custom_css_setting->id ), 4223 'code_type' => 'text/css', 4222 'label' => __( 'CSS code' ), 4223 'section' => 'custom_css', 4224 'settings' => array( 'default' => $custom_css_setting->id ), 4225 'code_type' => 'text/css', 4226 'input_attrs' => array( 4227 'aria-describedby' => 'editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4', 4228 ), 4224 4229 ) ) ); 4225 4230 } -
trunk/src/wp-includes/class-wp-customize-panel.php
r41390 r41586 364 364 ?></span> 365 365 <# if ( data.description ) { #> 366 <button class="customize-help-toggle dashicons dashicons-editor-help" tabindex="0" aria-expanded="false"><span class="screen-reader-text"><?php _e( 'Help' ); ?></span></button>366 <button type="button" class="customize-help-toggle dashicons dashicons-editor-help" aria-expanded="false"><span class="screen-reader-text"><?php _e( 'Help' ); ?></span></button> 367 367 <# } #> 368 368 </div> -
trunk/src/wp-includes/customize/class-wp-customize-code-editor-control.php
r41558 r41586 72 72 $json['code_type'] = $this->code_type; 73 73 $json['editor_settings'] = $this->editor_settings; 74 $json['input_attrs'] = $this->input_attrs; 74 75 return $json; 75 76 } … … 99 100 <# } #> 100 101 <div class="customize-control-notifications-container"></div> 101 <textarea id="{{ elementIdPrefix }}_editor" class="code"></textarea> 102 <textarea id="{{ elementIdPrefix }}_editor" 103 <# _.each( _.extend( { 'class': 'code' }, data.input_attrs ), function( value, key ) { #> 104 {{{ key }}}="{{ value }}" 105 <# }); #> 106 ></textarea> 102 107 <?php 103 108 } -
trunk/src/wp-includes/widgets/class-wp-widget-custom-html.php
r41558 r41586 213 213 <# var elementIdPrefix = 'el' + String( Math.random() ).replace( /\D/g, '' ) + '_' #> 214 214 <p> 215 <label for="{{ elementIdPrefix }}title"><?php esc_html_e( 'Title:' , 'default'); ?></label>215 <label for="{{ elementIdPrefix }}title"><?php esc_html_e( 'Title:' ); ?></label> 216 216 <input id="{{ elementIdPrefix }}title" type="text" class="widefat title"> 217 217 </p> 218 218 219 219 <p> 220 <label for="{{ elementIdPrefix }}content" class="screen-reader-text"><?php esc_html_e( 'Content:', 'default' ); ?></label>220 <label for="{{ elementIdPrefix }}content" id="{{ elementIdPrefix }}content-label"><?php esc_html_e( 'Content:' ); ?></label> 221 221 <textarea id="{{ elementIdPrefix }}content" class="widefat code content" rows="16" cols="20"></textarea> 222 222 </p> … … 231 231 <# if ( data.codeEditorDisabled ) { #> 232 232 <p> 233 <?php _e( 'Some HTML tags are not permitted, including:' , 'default'); ?>233 <?php _e( 'Some HTML tags are not permitted, including:' ); ?> 234 234 <code><?php echo join( '</code>, <code>', $disallowed_html ); ?></code> 235 235 </p> … … 255 255 $content .= '</p>'; 256 256 257 $content .= '<p>' . __( 'When using a keyboard to navigate:' ) . '</p>'; 258 $content .= '<ul>'; 259 $content .= '<li>' . __( 'In the HTML edit field, Tab enters a tab character.' ) . '</li>'; 260 $content .= '<li>' . __( 'To move keyboard focus, press Esc then Tab for the next element, or Esc then Shift+Tab for the previous element.' ) . '</li>'; 261 $content .= '</ul>'; 262 263 $content .= '<p>'; 264 $content .= sprintf( 265 /* translators: placeholder is link to user profile */ 266 __( 'The edit field automatically highlights code syntax. You can disable this in your %s to work in plan text mode.' ), 267 sprintf( 268 ' <a href="%1$s" class="external-link" target="_blank">%2$s<span class="screen-reader-text">%3$s</span></a>', 269 esc_url( get_edit_profile_url() . '#syntax_highlighting' ), 270 __( 'user profile' ), 271 /* translators: accessibility text */ 272 __( '(opens in a new window)', 'default' ) 273 ) 274 ); 275 $content .= '</p>'; 257 if ( 'false' !== wp_get_current_user()->syntax_highlighting ) { 258 $content .= '<p>'; 259 $content .= sprintf( 260 /* translators: placeholder is link to user profile */ 261 __( 'The edit field automatically highlights code syntax. You can disable this in your %s to work in plain text mode.' ), 262 sprintf( 263 ' <a href="%1$s" class="external-link" target="_blank">%2$s<span class="screen-reader-text">%3$s</span></a>', 264 esc_url( get_edit_profile_url() ), 265 __( 'user profile' ), 266 /* translators: accessibility text */ 267 __( '(opens in a new window)' ) 268 ) 269 ); 270 $content .= '</p>'; 271 272 $content .= '<p id="editor-keyboard-trap-help-1">' . __( 'When using a keyboard to navigate:' ) . '</p>'; 273 $content .= '<ul>'; 274 $content .= '<li id="editor-keyboard-trap-help-2">' . __( 'In the editing area, the Tab key enters a tab character.' ) . '</li>'; 275 $content .= '<li id="editor-keyboard-trap-help-3">' . __( 'To move away from this area, press the Esc key followed by the Tab key.' ) . '</li>'; 276 $content .= '<li id="editor-keyboard-trap-help-4">' . __( 'Screen reader users: when in forms mode, you may need to press the Esc key twice.' ) . '</li>'; 277 $content .= '</ul>'; 278 } 276 279 277 280 $screen->add_help_tab( array(
Note: See TracChangeset
for help on using the changeset viewer.