Page MenuHomePhabricator

Images should be responsive in Vector and restrained to a max-size.
Open, MediumPublic5 Estimated Story Points

Description

All images wider than #content overflow. I cannot figure out why this issue has not been solved after so many years.

I think one solution could be applying...

max-width:100%;
height:auto;

... to all images, or to all images inside relevant containers like #content.

QA in beta

QA

Event Timeline

abian raised the priority of this task from to Medium.
abian updated the task description. (Show Details)
abian added projects: Design, WMF-Design.
abian added a subscriber: abian.

Is this issue part of any particular project? Screenshots can help here :)

Is this issue part of any particular project? Screenshots can help here :)

This issue can be found on all MediaWiki-based projects using default CSS, also on the Wikimedia projects. And, indeed, screenshots help, sorry for my ambiguity.

Attached:

  • w:en:Jimmy Wales, small window, example of an image with caption overflowing the page by the left

left-overflow.png (768×572 px, 166 KB)

right-overflow.png (605×1 px, 44 KB)

abian raised the priority of this task from Medium to High.Sep 23 2015, 7:21 PM

Yikes, that looks bad. Ping @Volker_E

I think so, raising priority...

Hi @abian - thanks for your question.
This is an edge case, with a mobile phone you're going to be redirected to https://en.m.wikipedia.org/wiki/Jimmy_Wales#Chicago_Options_Associates_and_Bomis
So the error on small width does only apply when you're sqeezing your desktop client browser below a certain width, which I wouldn't call a normal user's behavior (more one of a developer like myself ;) ).

Regarding the oversized images we could probably implement a max-width without having too many regressions elsewhere.
But we currently haven't set one because it should be up to the user to have as few restrictions as possible and users should also be clear that if we would go for max-width setting, and they gonna put in extra-large images, which are scaled down, you imply downloading the unnecessary data of an oversized and squeezed-down image on others and don't have the visual feedback.

Hi @abian - thanks for your question.

Thank you for your reply, @Volker_E.

This is an edge case, with a mobile phone you're going to be redirected to https://en.m.wikipedia.org/wiki/Jimmy_Wales#Chicago_Options_Associates_and_Bomis
So the error on small width does only apply when you're sqeezing your desktop client browser below a certain width, which I wouldn't call a normal user's behavior (more one of a developer like myself ;) ).

It is certainly a bad example, I only took a random article and forced this situation by squeezing my window. But there are many (many) images all around the Wikimedia projects, and MediaWiki-based projects in general, which are overflowing the page with common resolutions at the moment. I often have this problem with my netbook, which is not detected as a phone... since it's not a phone xD.

With large resolutions, users can size their windows in many different ways, and the projects should be ready for that. Even 'rare users' mean 'thousands of users'.

Regarding the oversized images we could probably implement a max-width without having too many regressions elsewhere.
But we currently haven't set one because it should be up to the user to have as few restrictions as possible and users should also be clear that if we would go for max-width setting, and they gonna put in extra-large images, which are scaled down, you imply downloading the unnecessary data of an oversized and squeezed-down image on others and don't have the visual feedback.

Extra-large images can be (and are usually) included in frames like this using overflow and overflow-x.

max-width is not a restriction because pages are not designed to be overflowed, that situation is completely undesirable (a bug) and produces an ugly and inconsistent result. And I think that overflowing the page is much worse than downloading the unnecessary data of an oversized and squeezed-down image (an issue that could be discussed and solved as well, independently).

Jdlrobson renamed this task from Prevent images from overflowing the page to Prevent images from overflowing the page when resizing browser on desktop .Jun 21 2017, 12:28 AM
Jdlrobson lowered the priority of this task from High to Low.
Jdlrobson added a project: Vector.
Jdlrobson renamed this task from Prevent images from overflowing the page when resizing browser on desktop to Images should be responsive in Vector and restrained to a max-size..Jan 15 2020, 6:27 PM
Jdlrobson raised the priority of this task from Low to Medium.
Jdlrobson added a subscriber: Jdlrobson.

In new Vector if we limit the size of the article this is going to be a problem.

This is one of those things that seems so simple, but in reality is really hard, because we use floating images and have lots of assumptions in existing content.
I believe the biggest challenge here was the thumbnail frame wrapping (which is one of the reasons minerva doesn't have a frame)

/* put inside a media query for narrow pages */
div.thumb {
    margin-left: 0; /*(need to override trigh/tleft margins and floats) */
    margin-right: 0;
    clear: both;
    float: none;
    max-width: 100%;
}
div.thumbinner {
    max-width: 100%;
    margin-left: auto; /* center the frame for smaller thumbnails */
    margin-right: auto;
}
img {
    max-width: 100%;
    height: auto;
    box-sizing: border-box; /* img have 1px borders, which need to be added to the 100% */
}

and then you still need to account for panoramas, audio, video, maps and other images with noresize requirements because they are already framed in a scrollable view. As so often the problem is not gonna be fixing this, but not breaking anything else that depends on it ;)

I suggest at least adding an additional class to dom for inline images, because currently it is difficult to apply styling to JUST inline images (excluding thumbnails).

This may be considered related to Accessibility because when someone improves the quality of an image it immediately breaks all the related pages with that non-thumbed image, with that weird result that make the multimedia file not easily understandable anymore for normal users or users with difficulties. For SVG images and videos in other wikis this problem is evident.

Maybe the parser could give an hint in the HTML to add a class to the image if it was generated with minimal wikitext (e.g. no class, width, etc.). A class like normal-image or something like that, easy to be customized with a default CSS rule to be applied in all the wikis (I think) without much regressions.

ovasileva raised the priority of this task from Medium to High.Feb 25 2020, 8:18 AM

This will need to be addressed as part of the work on fixed width.

per a discussion I had with @Jdlrobson I'm unassigning this from myself.

It would be great to document examples of where this issue is occurring. The wide images I've found (e.g. https://en.wikipedia.org/wiki/New_York_City#Boroughs) seem to respond correctly to narrowing the browser, showing a scrollbar when they run out of space:

In T113101#5938189, @alexhollender wrote:

It would be great to document examples of where this issue is occurring. The wide images I've found (e.g. https://en.wikipedia.org/wiki/New_York_City#Boroughs) seem to respond correctly to narrowing the browser, showing a scrollbar when they run out of space:

Note that this specific example actually demonstrates the opposite fact, because the New York City Page is not using the standard syntax to display that image:

[[File:Brooklyn Skyline (9910358874).jpg]]

They do not use that syntax because it will break the page. So they use a workaround, involving a template and a Lua module that generates this wikitext:

<div class="thumb tnone" style="margin:0 auto;overflow:hidden;width:auto;max-width:1408px"><div class="thumbinner"><div class="noresize" style="overflow:auto;direction:rtl">[[File:Brooklyn Skyline (9910358874).jpg|1400px|alt=|&#x202A;<div align=center>[[Downtown Brooklyn]] at the western end of [[Long Island]]. The [[Manhattan Bridge]] (far left) and the [[Brooklyn Bridge]] (near left) are seen across the [[East River]] from [[Lower Manhattan]] at in June 2013.</div>&#x202C;]]</div><div class="thumbcaption"><div class="magnify">[[:File:Brooklyn Skyline (9910358874).jpg| ]]</div><div align=center>[[Downtown Brooklyn]] at the western end of [[Long Island]]. The [[Manhattan Bridge]] (far left) and the [[Brooklyn Bridge]] (near left) are seen across the [[East River]] from [[Lower Manhattan]] at in June 2013.</div></div></div></div>

So, that example demonstrates that every single wiki has its own local workarounds for this bug, because images in MediaWiki are not responsive at all.

ovasileva lowered the priority of this task from High to Medium.Apr 28 2020, 2:10 PM
LGoto added a subscriber: LGoto.

This task was closed as part of backlog upkeep. If you believe it was closed in error, please respond on the ticket.

Change 793555 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/core@master] Restrict img tags to the maximum available space

https://gerrit.wikimedia.org/r/793555

I think this one was likely closed in error. I ran into it while working on the grid.

Change 793555 merged by jenkins-bot:

[mediawiki/core@master] Restrict img tags to the maximum available space

https://gerrit.wikimedia.org/r/793555

Change 803592 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/core@master] Make thumbnails responsive at low resolutions and responsive skins

https://gerrit.wikimedia.org/r/803592

Change 803919 had a related patch set uploaded (by Esanders; author: Esanders):

[mediawiki/core@master] Revert "Restrict img tags to the maximum available space"

https://gerrit.wikimedia.org/r/803919

Change 803919 merged by jenkins-bot:

[mediawiki/core@master] Revert "Restrict img tags to the maximum available space"

https://gerrit.wikimedia.org/r/803919

Copying over @Esanders' comment on the ticket that got this reverted:

Note that the VE surface approximately uses Parsoid HTML, which this change appears not to be compatible with. The selector seems scarily generic (.mw-parser-output img) so it should be tested against a wide range of content (e.g. galleries and other rich media extensions in both parsers) before merging it again.

The regression (T310286) that caused the patch to be reverted was this in VE:

Screenshot 2022-06-09 at 15.08.32.png (670×624 px, 32 KB)

while doing this task we should consider the editing workflows that result in images being larger than the max-width. this includes both dragging the image, or setting the value of it:

draggingsetting the value
Screen Shot 2022-06-14 at 1.36.09 PM.png (741×1 px, 372 KB)
Screen Shot 2022-06-14 at 1.37.27 PM.png (723×1 px, 454 KB)

to clarify: fixing this should include limiting the ability to make images larger than 960px in the editor

I'm not sure I agree that the limitations of a skin should be reflected in the editor. What if the wiki predominately uses a wider skin? How do we decided which wikis would get this limitation?

Another case would be if the image is wrapped in scrollable container, e.g. a panoramic photo. In that case the image would want to wider than the known page limit because the editor knows the overflow will be handled gracefully.

@Esanders understood. I've just re-worded my comment to say that we should consider the editing workflows (rather than suggesting a particular change). Is the editor aware of the skin that one is using when editing?

@Esanders maybe another way to think about this is (granted I don't understand the relationship between the editor and the skin): if Vector 2022 becomes the default skin then we can assume it's the skin being used by most projects. If people/projects using other skins want to override this limitation they can edit the skin to do so. In other words we should optimize all experiences for the default skin, and allow other skins to be a secondary concern.

On the other hand, if your team doesn't think it will be a confusing experience for people to be able to edit images to a size larger than they will be presented in read-mode, this is maybe not an issue.