Making WordPress.org


Ignore:
Timestamp:
08/26/2021 11:34:14 PM (3 years ago)
Author:
coffee2code
Message:

Developer, Dashicons: Use human-readable labels for icons instead of character codes.

Makes it clear when scanning grid what a particular icon represents and facilitates in-page (ctrl-f) browser searches for finding an icon.

  • Outputs icons as list items instead of divs
  • Reformats output markup of dashicons to avoid use of hidden text
  • Embeds keywords and character codes as data attributes
  • Preserves filtered keyword search

Props dufresnesteven, ryelle, coffee2code.
Fixes #5014

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/page-dashicons.php

    r11196 r11206  
    1111
    1212wp_enqueue_style(  'dashicons-page', get_template_directory_uri() . '/stylesheets/page-dashicons.css', array(), '20200427' );
    13 wp_enqueue_script( 'dashicons-page', get_template_directory_uri() . '/js/page-dashicons.js', array( 'jquery', 'wp-util' ), '20200427' );
     13wp_enqueue_script( 'dashicons-page', get_template_directory_uri() . '/js/page-dashicons.js', array( 'jquery', 'wp-util' ), '20210826' );
    1414
    1515get_header(); ?>
     
    4040                    echo "<!-- {$group} -->\n";
    4141
     42                    echo "<ul>\n";
    4243                    foreach ( $group_info['icons'] as $name => $info ) {
    4344                        printf(
    44                             '<div alt="%s" class="dashicons %s">%s</div>' . "\n",
    45                             $info['code'],
    46                             $name,
    47                             $info['keywords']
     45                            '<li data-keywords="%s" data-code="%s" class="dashicons %s"><span>%s</span></li>' . "\n",
     46                            esc_attr( $info['keywords'] ),
     47                            esc_attr( $info['code'] ),
     48                            esc_attr( $name ),
     49                            $info['label']
    4850                        );
    4951                    }
     52                    echo "</ul>\n";
    5053                endforeach;
    5154                ?>
Note: See TracChangeset for help on using the changeset viewer.