WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#43078 closed defect (bug) (duplicate)

Caption Max-width set incorrectly

Reported by: jkorchok Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.9.1
Component: Media Keywords:
Focuses: Cc:

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">
http://www.brandwares.com/images/MyTheme.png
http://www.brandwares.com/images/TwentyFifteen.png

Change History (6)

#1 @joyously
3 years ago

  • Component changed from General to Media

When I look at the history of the img_caption_shortcode function, it has always used some form of (int) $width for the sanitization of the width, so I don't see how a percentage would ever have worked.

This ticket was mentioned in Slack in #core-media by desrosj. View the logs.


3 years ago

#3 @jkorchok
3 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.

This ticket was mentioned in Slack in #core-media by desrosj. View the logs.


3 years ago

This ticket was mentioned in Slack in #core-media by desrosj. View the logs.


3 years ago

#6 @desrosj
3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Thanks for the ticket, @jkorchok! This will be addressed in #43123, so I am going to close this out as a duplicate.

Note: See TracTickets for help on using tickets.