[wp-trac] [WordPress Trac] #26642: [caption] is 10px too wide
WordPress Trac
noreply at wordpress.org
Sat Mar 8 11:35:59 UTC 2014
#26642: [caption] is 10px too wide
-------------------------+------------------------------
Reporter: Looimaster | Owner:
Type: enhancement | Status: reopened
Priority: normal | Milestone: Awaiting Review
Component: Media | Version: 3.8
Severity: normal | Resolution:
Keywords: | Focuses:
-------------------------+------------------------------
Comment (by jond3r):
Hello, jumping in from #27292 to this hijacked ticket ;). Seems like
obenland and I was thinking about captions and HTML5 about the same time.
My two cents on various topics:
About adding an inline style width + 10px: As ocean90 pointed out
(#comment:4) this can be removed on the front-end using the filter
{{{img_caption_shortcode_width}}}. This filter does not work in the visual
editor though (?). Uncertain if it is possible to get it working there.
Obenland suggests that by adding a new html5 theme support 'caption', the
markup should change to use <figure> and <figcaption> elements and skip
the inline width style altogether. Also bypassing the
{{{img_caption_shortcode_width}}} filter. One could argue that this
special treatment of HTML5-supported captions is not fully logical.
Removal of an inline style is unrelated to using HTML5 markup.
Using an inline width style for an image with a caption can be useful. For
example, say that you have a small (narrow) image with a fairly long
caption. Then using an inline width style that is wider than the image can
make things look better, as there will be fewer line breaks in the
caption. As the image width might be unknown to the style sheet, using an
inline style might be warranted.
The patch in #27292 also utilizes the 'caption' html5 support to get
<figure> and <figcaption> elements but does not change the treatment of
the inline style.
In case the approach in the current thread is adopted, the unit test
provided in #27292 can still be used. (Though it could be tweaked to
explicitly check for the presence of a style attribute if desired).
--
Ticket URL: <https://core.trac.wordpress.org/ticket/26642#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list