WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#31253 closed defect (bug) (fixed)

Images should be forced to fit inside the editor

Reported by: iseulde Owned by: iseulde
Milestone: 4.3 Priority: normal
Severity: normal Version:
Component: TinyMCE Keywords: has-patch
Focuses: Cc:

Description (last modified by iseulde)

I think it would be best if images and captions have a max-width: 100%;.

This appeared to be a bit of a problem on iOS... Another bug, again.
Inside iframes, Safari on iOS doesn't obey max-width if a width is set on the element. It does work if a width attribute is used though. The only solution seems to be overwriting with width: auto;.

Related:

#24968
$content_width not constraining images in fullscreen editor
#30696
Inline media toolbar positioning
#31250
Twenty Fifteen editor styles look weird on mobile


Attachments (4)

image.jpg (82.9 KB) - added by iseulde 5 years ago.
31253.patch (773 bytes) - added by iseulde 5 years ago.
31253.2.patch (801 bytes) - added by iseulde 5 years ago.
31253.3.patch (589 bytes) - added by iseulde 4 years ago.

Download all attachments as: .zip

Change History (13)

@iseulde
5 years ago

@iseulde
5 years ago

#1 @iseulde
5 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 4.2

@iseulde
5 years ago

#2 @iseulde
5 years ago

Forgot height: auto; :)
The only (minor) issue here is that some themes add a margin to images inside captions, so the image might overflow the caption area. Themes should add padding to the parent element instead. We should adjust our bundled themes.

#3 @iseulde
5 years ago

  • Description modified (diff)

This ticket was mentioned in Slack in #core by drew. View the logs.


5 years ago

#5 @DrewAPicture
5 years ago

  • Owner set to azaozz
  • Status changed from new to reviewing

As I recall, the Press This folks ran into the same issue with media overflowing the editor viewport. If we could, I'd like get insight from @azaozz on how they decided to handle that.

I think the issue is partially that $content_width defines the width as part of or in conjunction with themes' editor stylesheets, so would artificially constraining media to visible in the editor viewport mess too much with that?

#6 @iseulde
4 years ago

I think the issue is partially that $content_width defines the width as part of or in conjunction with themes' editor stylesheets, so would artificially constraining media to visible in the editor viewport mess too much with that?

No, width 100% obeys the width of the body.

An argument against doing this is that the theme might not set this on the front end and surprise the user. I still think we should do this because

1) most themes do force the image to fit on the front end and forget to do this in the editor (even our default themes before [31849]),
2) it's a really bad writing experience,
3) the theme does not need to provide any styles, so the defaults should be good, and
4) the editor can be used for things other than the post content.

Last edited 4 years ago by iseulde (previous) (diff)

#7 @DrewAPicture
4 years ago

  • Milestone changed from 4.2 to Future Release
  • Owner azaozz deleted

I don't think there's enough of a justification to make this kind of change at this point in the cycle. I think we need to fall back and get more discussion on the expected behavior here before we can really talk about implementing such a change. Punting.

@iseulde
4 years ago

#8 @iseulde
4 years ago

  • Owner set to iseulde
  • Resolution set to fixed
  • Status changed from reviewing to closed

In 33417:

Editor: fit images

Fixes #31253.

#9 @iseulde
4 years ago

  • Milestone changed from Future Release to 4.3
Note: See TracTickets for help on using tickets.