[wp-trac] [WordPress Trac] #47612: Media modal: implement a default title for the modal H1 heading
WordPress Trac
noreply at wordpress.org
Sat Aug 10 07:28:05 UTC 2019
#47612: Media modal: implement a default title for the modal H1 heading
-------------------------------------+-------------------------------------
Reporter: afercia | Owner: audrasjb
Type: defect (bug) | Status: accepted
Priority: normal | Milestone: 5.3
Component: Media | Version:
Severity: normal | Resolution:
Keywords: needs-patch reporter- | Focuses: accessibility,
feedback has-screenshots | javascript
-------------------------------------+-------------------------------------
Changes (by audrasjb):
* keywords: needs-patch => needs-patch reporter-feedback has-screenshots
Comment:
Hi there,
I was able to reproduce the issue with the testing plugin (available as an
attachement of that ticket). This plugin creates a media metabox without
any title for the media modal.
I found how to add a default `h1` title on a built version of WordPress
but I wasn't able to reproduce it on WordPress Dev/Trunk. Any help would
be awesome :)
Here is my workaround to fix the issue on a classic WordPress
installation:
- Install the provided testing plugin to add a media metabox in your
posts.
- Reproduce the issue: when you open the metabox media modal, there is an
empty `h1` tag in the modal.
- In `wp-includes/js/media-views.js`:
Line 2932, replace:
{{{
/**
* @constructs
*/
initialize: function() {
Frame.prototype.initialize.apply( this, arguments );
_.defaults( this.options, {
title: '',
modal: true,
uploader: true
});
// Ensure core UI is enabled.
this.$el.addClass('wp-core-ui');
}}}
with
{{{
/**
* @constructs
*/
initialize: function() {
Frame.prototype.initialize.apply( this, arguments );
var media = wp.media,
l10n;
l10n = media.view.l10n = window._wpMediaViewsL10n || {};
_.defaults( this.options, {
title: l10n.addMedia,
modal: true,
uploader: true
});
// Ensure core UI is enabled.
this.$el.addClass('wp-core-ui');
}}}
- Save `media-views.js` as `media-views.js` to replace the existing
minified file.
- The default title is now displayed in the medial modal, as in the second
screenshot above.
Now, we need to reproduce that fix in Trunk 😛
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47612#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list