Opened 9 years ago
Closed 9 years ago
#43078 closed defect (bug) (duplicate)
Caption Max-width set incorrectly
| Reported by: | jkorchok | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Media | Version: | 4.9.1 |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
After upgrading to 4.9.1, caption widths expressed in percentages are converted to max-width in pixels. A caption setting of width="100%" is converted to max-width="100px" in the page source. Below is the effect in both my custom theme and in the Twenty Fifteen theme.
Post text: [caption id="attachment_864" align="alignnone" width="100%"]
Page Source: <figure id="attachment_864" style="max-width: 100px" class="wp-caption alignnone">


Change History (6)
This ticket was mentioned in Slack in #core-media by desrosj. View the logs.
9 years ago
#3
@
9 years ago
I've been using width="100%" since 2013 and it worked as expected until upgrading to 4.9.1.
Are you familiar with the concept of Responsive web design? Here's an introduction: https://www.w3schools.com/css/css_rwd_intro.asp
Responsive design requires flexibility in object sizing and fixed pixel widths don't cut it. That's why I've been using percentage widths, and it's why someone needs to fix this.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
When I look at the history of the
img_caption_shortcodefunction, it has always used some form of(int) $widthfor the sanitization of the width, so I don't see how a percentage would ever have worked.