Editor: Add missing label to `new-post-slug` input on Classic Editor.

Previously, the input for changing the permalink of a post does not have a label in the Classic Editor. This change adds a visually hidden label. It also makes sure browsers do not run spellcheck on the input field.

Props sabernhardt.
Fixes #53725.

Built from https://develop.svn.wordpress.org/trunk@52225


git-svn-id: http://core.svn.wordpress.org/trunk@51817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2021-11-19 22:55:59 +00:00
parent 966c7376b4
commit 1bd5af61d2
3 changed files with 5 additions and 4 deletions

View File

@ -972,7 +972,7 @@ jQuery( function($) {
* @return {void} * @return {void}
*/ */
function editPermalink() { function editPermalink() {
var i, slug_value, var i, slug_value, slug_label,
$el, revert_e, $el, revert_e,
c = 0, c = 0,
real_slug = $('#post_name'), real_slug = $('#post_name'),
@ -1048,8 +1048,9 @@ jQuery( function($) {
c++; c++;
} }
slug_value = ( c > full.length / 4 ) ? '' : full; slug_value = ( c > full.length / 4 ) ? '' : full;
slug_label = __( 'URL Slug' );
$el.html( '<input type="text" id="new-post-slug" value="' + slug_value + '" autocomplete="off" />' ).children( 'input' ).on( 'keydown', function( e ) { $el.html( '<label for="new-post-slug" class="screen-reader-text">' + slug_label + '</label><input type="text" id="new-post-slug" value="' + slug_value + '" autocomplete="off" spellcheck="false" />' ).children( 'input' ).on( 'keydown', function( e ) {
var key = e.which; var key = e.which;
// On [Enter], just save the new slug, don't save the post. // On [Enter], just save the new slug, don't save the post.
if ( 13 === key ) { if ( 13 === key ) {

File diff suppressed because one or more lines are too long

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.9-alpha-52224'; $wp_version = '5.9-alpha-52225';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.