Make WordPress Core

Opened 4 months ago

Last modified 4 weeks ago

#60158 accepted defect (bug)

The description field for media doesn't automatically make paragraphs in the generated code

Reported by: juliemoynat's profile juliemoynat Owned by: joedolson's profile joedolson
Milestone: 6.6 Priority: normal
Severity: normal Version:
Component: Media Keywords: has-patch changes-requested needs-unit-tests needs-testing
Focuses: accessibility Cc:


There are two ways to edit a media:

  • via a modal window where all the contribution fields are only simple textareas;
  • via a dedicated web page where "alternative text" and "caption" fields are simple textareas and the "description" field is a WYSIWYG editor in text mode where TinyMCE is deactivated.

For some media, you can need to add a long description just like a transcript (for videos, audios, complex images like infographic, etc.).
So, in these cases, the description field can be used because it's totally appropriate.

But, there is a problem: usually, in editor fields, the paragraphs (<p> elements) are automatically added when you display the web page (in the front view). In this field, they are not.

For accessibility reason, paragraphs need to be HTML paragraphs (WCAG Success Criterion 1.3.1: Info and Relationships (level A)).

I've tried to modify the code in the core to add TinyMCE that is explicitly deactivated and this is fixing the problem.

It's in wp-admin/includes/media.php, on line 3261 where you can just change "false" to "true" for "tinymce":

$quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close' );
$editor_args        = array(
        'textarea_name' => 'content',
        'textarea_rows' => 5,
        'media_buttons' => false,
        'tinymce'       => false,
        'quicktags'     => $quicktags_settings,

So, is it possible to activate TinyMCE for this field? Why is it deactivated?
Or, if it's not possible, is it possible to make this option hookable?

Thank you

Change History (9)

@mukesh27 commented on PR #5822:

4 months ago

Thanks @sebastienserre for the PR. Left one minor suggestion. Is it possible to add unit test for new filter?

#3 @mukesh27
4 months ago

  • Keywords changes-requested added
  • Version 6.4.2 deleted

#4 @sebastienserre
4 months ago

  • Keywords needs-unit-tests needs-testing added

I unfortunately don't know writing test for the moment :(

This ticket was mentioned in Slack in #core-test by webtechpooja. View the logs.

3 months ago

#6 @juliemoynat
2 months ago


Is there any chance that someone who knows how to write unit tests will take over the rest of this small ticket?


#7 @joedolson
2 months ago

  • Owner set to joedolson
  • Status changed from new to accepted

This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.

4 weeks ago

#9 @joedolson
4 weeks ago

  • Milestone changed from Awaiting Review to 6.6

This looks good. Since it's just adding a filter, and not actually changing the default behavior, it's pretty safe. I do think that it's not an option to just change the default, since it's very hard to know how the image description has been used on the front-end by existing tools.

Milestoning for 6.6.

Note: See TracTickets for help on using tickets.