WordPress.org

Make WordPress Core

Changeset 52225


Ignore:
Timestamp:
11/19/2021 10:54:34 PM (3 weeks ago)
Author:
audrasjb
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/admin/post.js

    r50547 r52225  
    973973     */
    974974    function editPermalink() {
    975         var i, slug_value,
     975        var i, slug_value, slug_label,
    976976            $el, revert_e,
    977977            c = 0,
     
    10491049        }
    10501050        slug_value = ( c > full.length / 4 ) ? '' : full;
    1051 
    1052         $el.html( '<input type="text" id="new-post-slug" value="' + slug_value + '" autocomplete="off" />' ).children( 'input' ).on( 'keydown', function( e ) {
     1051        slug_label = __( 'URL Slug' );
     1052
     1053        $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 ) {
    10531054            var key = e.which;
    10541055            // On [Enter], just save the new slug, don't save the post.
Note: See TracChangeset for help on using the changeset viewer.