WordPress.org

Make WordPress Core

Changeset 44969


Ignore:
Timestamp:
03/21/2019 09:04:49 PM (5 weeks ago)
Author:
adamsilverstein
Message:

Media: introduce a "Heading" view for improved accessibility.

  • Add a new media view: wp.media.view.Heading designed to add accessibility friendly headers in the media library/modal.
  • Add an initial "Attachments list" heading above the attachments list.

Props afercia.
Fixes #36925.

Location:
trunk/src
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/wp/media/views.js

    r43347 r44969  
    152152media.view.EditImage = require( '../../../media/views/edit-image.js' );
    153153media.view.Spinner = require( '../../../media/views/spinner.js' );
     154media.view.Heading = require( '../../../media/views/heading.js' );
  • trunk/src/js/media/views/attachments/browser.js

    r43309 r44969  
    6262        this.createToolbar();
    6363
     64        // Add a heading before the attachments list.
     65        this.createAttachmentsHeading();
     66
    6467        // Create the list of attachments.
    6568        this.createAttachments();
     
    408411    },
    409412
     413    createAttachmentsHeading: function() {
     414        this.attachmentsHeading = new wp.media.view.Heading( {
     415            text: l10n.attachmentsList,
     416            level: 'h2',
     417            className: 'media-views-heading screen-reader-text'
     418        } );
     419        this.views.add( this.attachmentsHeading );
     420    },
     421
    410422    createSidebar: function() {
    411423        var options = this.options,
  • trunk/src/wp-includes/media.php

    r44951 r44969  
    37633763        'addToVideoPlaylist'          => __( 'Add to video playlist' ),
    37643764        'addToVideoPlaylistTitle'     => __( 'Add to Video Playlist' ),
     3765
     3766        // Headings
     3767        'attachmentsList'             => __( 'Attachments list' ),
    37653768    );
    37663769
Note: See TracChangeset for help on using the changeset viewer.