WordPress.org

Make WordPress Core

Changeset 29428


Ignore:
Timestamp:
08/07/2014 05:19:14 AM (6 years ago)
Author:
wonderboymusic
Message:

Media Grid: add screen reader labels with more context to filters and bulk actions. Ditto for list view.

Props afercia.
Fixes #29026.

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-list-table.php

    r29423 r29428  
    372372            return;
    373373
    374         echo "<label for='bulk-action-selector-" . esc_attr( $which ) . "' class='screen-reader-text'>" . __( 'Select Bulk Action' ) . "</label>";
     374        echo "<label for='bulk-action-selector-" . esc_attr( $which ) . "' class='screen-reader-text'>" . __( 'Select bulk action' ) . "</label>";
    375375        echo "<select name='action$two' id='bulk-action-selector-" . esc_attr( $which ) . "'>\n";
    376376        echo "<option value='-1' selected='selected'>" . __( 'Bulk Actions' ) . "</option>\n";
     
    470470        $m = isset( $_GET['m'] ) ? (int) $_GET['m'] : 0;
    471471?>
    472         <select name="m">
     472        <label for="filter-by-date" class="screen-reader-text"><?php _e( 'Filter by date' ); ?></label>
     473        <select name="m" id="filter-by-date">
    473474            <option<?php selected( $m, 0 ); ?> value="0"><?php _e( 'All dates' ); ?></option>
    474475<?php
  • trunk/src/wp-includes/js/media-grid.js

    r29427 r29428  
    566566     */
    567567    media.view.BulkSelectionActionDropdown = media.View.extend({
    568         tagName:   'select',
     568        tagName: 'select',
     569        id:      'bulk-select-dropdown',
    569570
    570571        initialize: function() {
  • trunk/src/wp-includes/js/media-views.js

    r29426 r29428  
    56985698                LibraryViewSwitcher,
    56995699                FiltersConstructor,
    5700                 screenReaderText;
     5700                filterByTypeLabel,
     5701                bulkActionsLabel,
     5702                filterByDateLabel,
     5703                searchLabel;
    57015704
    57025705            /**
     
    57135716            // which the controller can tap into and add this view?
    57145717            if ( this.controller.activeModes.where( { id: 'grid' } ).length ) {
     5718
    57155719                LibraryViewSwitcher = media.View.extend({
    57165720                    className: 'view-switch media-grid-view-switch',
    57175721                    template: media.template( 'media-library-view-switcher')
    57185722                });
     5723
    57195724                this.toolbar.set( 'libraryViewSwitcher', new LibraryViewSwitcher({
    57205725                    controller: this.controller,
     
    57225727                }).render() );
    57235728
    5724                 this.toolbar.set( 'bulkSelection', new media.view.BulkSelection({
    5725                     controller: this.controller,
    5726                     priority: -70
    5727                 }).render() );
    57285729                this.toolbar.set( 'dateFilter', new media.view.DateFilter({
    57295730                    controller: this.controller,
     
    57315732                    priority: -75
    57325733                }).render() );
     5734
     5735                this.toolbar.set( 'bulkSelection', new media.view.BulkSelection({
     5736                    controller: this.controller,
     5737                    priority: -70
     5738                }).render() );
     5739
     5740                this.toolbar.set( 'spinner', new media.view.Spinner({
     5741                    priority: -60
     5742                }) );
     5743
    57335744            }
    57345745
     
    57475758                }).render() );
    57485759
    5749                 screenReaderText = $( '<label class="screen-reader-text" for="media-attachment-filters">' + l10n.select + '</label>' );
    5750                 this.toolbar.get( 'filters' ).$el.before( screenReaderText );
    5751             }
    5752 
    5753             this.toolbar.set( 'spinner', new media.view.Spinner({
    5754                 priority: -70
    5755             }) );
     5760                filterByTypeLabel = $( '<label class="screen-reader-text" for="media-attachment-filters">' + l10n.filterByType + '</label>' );
     5761                this.toolbar.get( 'filters' ).$el.before( filterByTypeLabel );
     5762
     5763                filterByDateLabel = $( '<label class="screen-reader-text" for="media-attachment-date-filters">' + l10n.filterByDate + '</label>' );
     5764                this.toolbar.get( 'dateFilter' ).$el.before( filterByDateLabel );
     5765
     5766                bulkActionsLabel = $( '<label class="screen-reader-text" for="bulk-select-dropdown">' + l10n.bulkActionsLabel + '</label>' );
     5767                this.toolbar.get( 'bulkSelection' ).$el.before( bulkActionsLabel );
     5768            }
    57565769
    57575770            if ( this.options.search ) {
     
    57615774                    priority:   60
    57625775                }).render() );
    5763                 screenReaderText = $( '<label class="screen-reader-text" for="media-search-input">' + l10n.search + '</label>' );
    5764                 this.toolbar.get( 'search' ).$el.before( screenReaderText );
     5776                searchLabel = $( '<label class="screen-reader-text" for="media-search-input">' + l10n.searchMediaLabel + '</label>' );
     5777                this.toolbar.get( 'search' ).$el.before( searchLabel );
    57655778            }
    57665779
  • trunk/src/wp-includes/media.php

    r29426 r29428  
    29292929        'warnBulkDelete'         => __( "You are about to permanently delete these items.\n  'Cancel' to stop, 'OK' to delete." ),
    29302930        'bulkActions'            => __( 'Bulk Actions' ),
     2931        'bulkActionsLabel'       => __( 'Select bulk action' ),
    29312932        'deletePermanently'      => __( 'Delete Permanently' ),
    29322933        'apply'                  => __( 'Apply' ),
     2934        'filterByDate'           => __( 'Filter by date' ),
     2935        'filterByType'           => __( 'Filter by type' ),
     2936        'searchMediaLabel'       => __( 'Search Media' ),
    29332937
    29342938        // Library Details
Note: See TracChangeset for help on using the changeset viewer.