diff --git src/js/_enqueues/wp/media/views.js src/js/_enqueues/wp/media/views.js
index 01b8d00c42..76c79e0b63 100644
|
|
media.view.SiteIconCropper = require( '../../../media/views/site-icon-cropper.js |
151 | 151 | media.view.SiteIconPreview = require( '../../../media/views/site-icon-preview.js' ); |
152 | 152 | media.view.EditImage = require( '../../../media/views/edit-image.js' ); |
153 | 153 | media.view.Spinner = require( '../../../media/views/spinner.js' ); |
| 154 | media.view.Heading = require( '../../../media/views/heading.js' ); |
diff --git src/js/media/views/attachments/browser.js src/js/media/views/attachments/browser.js
index 0f4561b062..92f8387ce8 100644
|
|
AttachmentsBrowser = View.extend(/** @lends wp.media.view.AttachmentsBrowser.pro |
61 | 61 | */ |
62 | 62 | this.createToolbar(); |
63 | 63 | |
| 64 | // Add a heading before the attachments list. |
| 65 | this.createAttachmentsHeading(); |
| 66 | |
64 | 67 | // Create the list of attachments. |
65 | 68 | this.createAttachments(); |
66 | 69 | |
… |
… |
AttachmentsBrowser = View.extend(/** @lends wp.media.view.AttachmentsBrowser.pro |
407 | 410 | } |
408 | 411 | }, |
409 | 412 | |
| 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 | |
410 | 422 | createSidebar: function() { |
411 | 423 | var options = this.options, |
412 | 424 | selection = options.selection, |
diff --git src/js/media/views/heading.js src/js/media/views/heading.js
new file mode 100644
index 0000000000..9c8c80be5e
-
|
+
|
|
| 1 | /** |
| 2 | * wp.media.view.Heading |
| 3 | * |
| 4 | * A reusable heading component for the media library |
| 5 | * |
| 6 | * Used to add accessibility friendly headers in the media library/modal. |
| 7 | * |
| 8 | * @class |
| 9 | * @augments wp.media.View |
| 10 | * @augments wp.Backbone.View |
| 11 | * @augments Backbone.View |
| 12 | */ |
| 13 | var Heading = wp.media.View.extend( { |
| 14 | tagName: function() { |
| 15 | return this.options.level || 'h1'; |
| 16 | }, |
| 17 | className: 'media-views-heading', |
| 18 | |
| 19 | initialize: function() { |
| 20 | |
| 21 | if ( this.options.className ) { |
| 22 | this.$el.addClass( this.options.className ); |
| 23 | } |
| 24 | |
| 25 | this.text = this.options.text; |
| 26 | }, |
| 27 | |
| 28 | render: function() { |
| 29 | this.$el.html( this.text ); |
| 30 | return this; |
| 31 | } |
| 32 | } ); |
| 33 | |
| 34 | module.exports = Heading; |
diff --git src/wp-includes/media.php src/wp-includes/media.php
index db150ab975..bb2e0b8e27 100644
|
|
function wp_enqueue_media( $args = array() ) { |
3762 | 3762 | 'updateVideoPlaylist' => __( 'Update video playlist' ), |
3763 | 3763 | 'addToVideoPlaylist' => __( 'Add to video playlist' ), |
3764 | 3764 | 'addToVideoPlaylistTitle' => __( 'Add to Video Playlist' ), |
| 3765 | |
| 3766 | // Headings |
| 3767 | 'attachmentsList' => __( 'Attachments list' ), |
3765 | 3768 | ); |
3766 | 3769 | |
3767 | 3770 | /** |