== Background
All images wider than `#content` [[https://test.wikipedia.org/wiki/User:Abi%C3%A1n/sandbox|overflow]]. This is a solved problem on Timeless, Monobook and Minerva and it is time we applied a global solution for all skins. In some articles, in Vector 2022 the images overlap the side bar, and communities insist that this should be considered a blocker for rolling out Vector 2022 as the default.
For example:
https://en.wikipedia.beta.wmflabs.org/wiki/T113101
This adapts in Minerva and is generally not an issue with legacy Vector which does not have a sidebar on the right, but in Vector 2022 it overlaps the content area.
{F54796098}
== User story
As a reader I want article images to fit within the available viewport space at all times for all skins.
# Acceptance criteria
[x] Limit floating rules in [[ https://github.com/wikimedia/mediawiki/blob/master/resources/src/mediawiki.skinning/content.media-common.less#L18C1-L34C3 | mediawiki.skinning ]] to`@media screen and ( min-width: @width-breakpoint-tablet ) {`
[x] Move the thumbnail styles that make images full screen on mobile from [[ https://github.com/wikimedia/mediawiki-skins-MinervaNeue/blob/master/resources/skins.minerva.base.styles/content/images.less#L49C1-L72C3 | from Minerva ]] to [[ https://github.com/wikimedia/mediawiki/blob/master/resources/src/mediawiki.skinning/content.thumbnails-common.less | mediawiki.skinning ]] so they apply to Vector 2022 and Minerva skin.
[x] Replace the `#content` selector with `body.skin--responsive .mw-parser-output`
[x] Once the above is merged add skin--responsive to the BODY element on Vector 2022 (this is our rollback strategy in case of an issue)
[x] Post a patch to Minerva that removes reference to the noresize class added in T330527 and the styles you have upstreamed to core as part of this task.
# QA in beta
[] Visit https://en.wikipedia.beta.wmflabs.org/wiki/Adam?useskin=vector and resize browser, the image **should not** resize as the window shrinks
[] Visit https://en.wikipedia.beta.wmflabs.org/wiki/Adam?useskin=vector-2022 and resize browser, the image **should** resize as the window shrinks
[] Check Parsoid HTML compatibility: Visit https://en.wikipedia.beta.wmflabs.org/wiki/T310286 and edit using VisualEditor. Make sure the image is constrained to the container (see T310286)
# QA
[] Visit https://en.wikipedia.org/wiki/The_Creation_of_Adam?useskin=vector and resize browser, the image **should not** resize as the window shrinks
[] Visit https://en.wikipedia.org/wiki/The_Creation_of_Adam?useskin=vector-2022 and resize browser, the image **should** resize as the window shrinks
[] Visit https://ru.wikipedia.org/wiki/%D0%A2%D1%83%D1%80%D1%86%D0%B8%D1%8F - no content should overlap the two Vector side bars.
== Requirement
Ensure images are responsive and restrained to a max-size in the Vector skin, avoiding overflow issues and enhancing compatibility across different skins. Test this functionality in both beta and production environments.
== BDD
```gherkin
Feature: Responsive Images in Vector
Scenario: Ensure images are responsive and fit within the available viewport
Given the user is viewing a page in the Vector skin
When an image is displayed
Then the image should be responsive and restrained to a max-size
And the image should not overflow or overlap other content
```
== Test Steps
__Test Case 1: Verify Responsive Images in Vector Skin__
1. Enable the responsive images feature.
2. For beta testing, use the links in the beta links table. For production testing, use the links in the production links table.
3. Resize the browser window to verify image responsiveness.
4. **AC1:** Confirm that images resize appropriately as the window shrinks.
5. **AC2:** Confirm that images are constrained to the container and do not overlap other content.
**Beta Links:**
| **#** | **Page Link** | **Screenshot** |
|-------|---------------|----------------|
| 1 | [Adam?useskin=vector](https://en.wikipedia.beta.wmflabs.org/wiki/Adam?useskin=vector) | |
| 2 | [Adam?useskin=vector-2022](https://en.wikipedia.beta.wmflabs.org/wiki/Adam?useskin=vector-2022) | |
| 3 | [T310286](https://en.wikipedia.beta.wmflabs.org/wiki/T310286) | |
**Production Links:**
| **#** | **Page Link** | **Screenshot** |
|-------|---------------|----------------|
| 1 | [The_Creation_of_Adam?useskin=vector](https://en.wikipedia.org/wiki/The_Creation_of_Adam?useskin=vector) | |
| 2 | [The_Creation_of_Adam?useskin=vector-2022](https://en.wikipedia.org/wiki/The_Creation_of_Adam?useskin=vector-2022) | |
| 3 | [Турция](https://ru.wikipedia.org/wiki/%D0%A2%D1%83%D1%80%D1%86%D0%B8%D1%8F) | |
## Notes
Videos are already OK:
* https://meta.wikimedia.org/w/index.php?title=User:Valerio_Bozzolan/Sandbox2&oldid=23877269
# Roll back plan
This change will be rolled out with style improvements for tables, infoboxes, hatnotes and images that improve how they display for mobile screens.
In case of unforeseen issues with tables/images, that severely damage the readability of the wiki per our criteria [[ https://wikitech.wikimedia.org/wiki/Deployments/Holding_the_train#Major_stylistic_problems_affecting_all_pages | for rolling back the train ]] we can revert the following patch safely at any given time to prompt more conversation/iteration:
https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/+/1038894