Make WordPress Core


Ignore:
Timestamp:
10/14/2016 10:39:49 PM (10 years ago)
Author:
azaozz
Message:

Accessible Tags autocomplete:

  • Replace suggest.js with UI Autocomplete.
  • Use the same settings like in the editor link toolbar.
  • Abstract it and add in a new file, tags-suggest.js. Then make it a dependency for the Tags postbox(es) and Quick and Bulk Edit.
  • Add data-wp-taxonomy on all input elements to improve handling in the UI for custom taxonomies.

Props afercia, azaozz.
See #33902.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/script-loader.php

    r38628 r38797  
    235235        /* translators: %d: Number of results found when using jQuery UI Autocomplete */
    236236        'manyResults' => __( '%d results found. Use up and down arrow keys to navigate.' ),
     237        'itemSelected' => __( 'Item selected.' ),
    237238    ) );
    238239
     
    242243    // jQuery plugins
    243244    $scripts->add( 'jquery-color', "/wp-includes/js/jquery/jquery.color.min.js", array('jquery'), '2.1.1', 1 );
    244     $scripts->add( 'suggest', "/wp-includes/js/jquery/suggest$suffix.js", array('jquery'), '1.1-20110113', 1 );
    245245    $scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array('jquery'), '20m', 1 );
    246246    $scripts->add( 'jquery-query', "/wp-includes/js/jquery/jquery.query.js", array('jquery'), '2.1.7', 1 );
     
    249249    $scripts->add( 'jquery-table-hotkeys', "/wp-includes/js/jquery/jquery.table-hotkeys$suffix.js", array('jquery', 'jquery-hotkeys'), false, 1 );
    250250    $scripts->add( 'jquery-touch-punch', "/wp-includes/js/jquery/jquery.ui.touch-punch.js", array('jquery-ui-widget', 'jquery-ui-mouse'), '0.2.2', 1 );
     251
     252    // Not used any more, registered for backwards compatibility.
     253    $scripts->add( 'suggest', "/wp-includes/js/jquery/suggest$suffix.js", array('jquery'), '1.1-20110113', 1 );
    251254
    252255    // Masonry v2 depended on jQuery. v3 does not. The older jquery-masonry handle is a shiv.
     
    524527        ) );
    525528
    526         $scripts->add( 'tags-box', "/wp-admin/js/tags-box$suffix.js", array( 'jquery', 'suggest' ), false, 1 );
    527         did_action( 'init' ) && $scripts->localize( 'tags-box', 'tagsBoxL10n', array(
     529        $scripts->add( 'tags-box', "/wp-admin/js/tags-box$suffix.js", array( 'jquery', 'tags-suggest' ), false, 1 );
     530
     531        $scripts->add( 'tags-suggest', "/wp-admin/js/tags-suggest$suffix.js", array( 'jquery-ui-autocomplete', 'wp-a11y' ), false, 1 );
     532        did_action( 'init' ) && $scripts->localize( 'tags-suggest', 'tagsSuggestL10n', array(
    528533            'tagDelimiter' => _x( ',', 'tag delimiter' ),
    529534        ) );
     
    585590        $scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'wp-backbone', 'wp-a11y' ), false, 1 );
    586591
    587         $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'suggest', 'wp-a11y' ), false, 1 );
     592        $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'tags-suggest', 'wp-a11y' ), false, 1 );
    588593        did_action( 'init' ) && $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(
    589594            'error'      => __( 'Error while saving the changes.' ),
Note: See TracChangeset for help on using the changeset viewer.