Skip to content

Only include the original image in the Image component if the image does not have all the scales present. Fixed and update tests.#7655

Merged
sneridagh merged 17 commits into
mainfrom
donotaddoriginalimagetothesrcset
Apr 9, 2026
Merged

Only include the original image in the Image component if the image does not have all the scales present. Fixed and update tests.#7655
sneridagh merged 17 commits into
mainfrom
donotaddoriginalimagetothesrcset

Conversation

@sneridagh
Copy link
Copy Markdown
Member

@sneridagh sneridagh commented Nov 24, 2025

Follow up: #7486 (Seven PR):

@sneridagh sneridagh requested a review from davisagli November 24, 2025 12:37
Comment thread docs/source/upgrade-guide/index.md Outdated
Comment thread docs/source/upgrade-guide/index.md Outdated
Comment thread docs/source/upgrade-guide/index.md Outdated
Comment thread docs/source/upgrade-guide/index.md Outdated
Copy link
Copy Markdown
Member

@davisagli davisagli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The presence of the original image didn't force the browser to choose it. But we set width and height to the original size and in most cases didn't set sizes, so the browser didn't have any way to know it could use a smaller scale.

I think setting sizes appropriately would allow the browser's scale selection to work better even if we did always include the original image. I have a slight preference for leaving the original image there, because if we remove it then it takes extra work to use it in the use cases where it's really what you need (i.e. full-width on a large monitor)

alt=""
loading="lazy"
responsive={true}
sizes="(max-width: 940px) 100vw, 940px"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we should use a smaller size when there are multiple columns.

I don't love hardcoding the default width, but I don't have a better suggestion. We can't use CSS properties because the whole point of sizes is to give the browser enough information to pick the right image before CSS has loaded.

Co-authored-by: Steve Piercy <web@stevepiercy.com>
@sneridagh
Copy link
Copy Markdown
Member Author

@stevepiercy I accepted all the suggestions, but David is working in the backend side, and we might amend them a bit the next days. Thanks!

@stevepiercy
Copy link
Copy Markdown
Collaborator

@sneridagh @davisagli please ping me again for a review when it's done cooking.

@stevepiercy
Copy link
Copy Markdown
Collaborator

Can someone else fix the broken links? I'm swamped.

https://github.com/plone/volto/actions/runs/19663404467/job/56314471303?pr=7655

@sneridagh
Copy link
Copy Markdown
Member Author

@stevepiercy it seems medium added some antibot measures... we cannot do anything about it. How do we proceed with this use cases?

@stevepiercy
Copy link
Copy Markdown
Collaborator

@sneridagh for Medium, ignore the entire domain with a regex in conf.py. There are existing examples. It also needs to be applied to the upstream plone/documentation conf.py.

For the others, fix the links that redirect.

@sneridagh
Copy link
Copy Markdown
Member Author

@davisagli once plone/plone.volto#205 is merged and released, we can go for this one. We might want to amend the docs with the released p.volto version.

@stevepiercy I amended the docs to reflect the latest changes.

Comment thread packages/volto/src/components/manage/Blocks/Teaser/DefaultBody.jsx Outdated
Copy link
Copy Markdown
Member

@davisagli davisagli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sneridagh I took another look at this. I still think it would be nice to make the following improvements:

  1. Add a config setting for the widths, instead of hardcoding 940px. (Also ideally inject them from the config setting into the CSS properties to avoid duplication, but we can live without that.)
  2. Give the teaser block contextual information about how many columns there are, so it can use smaller sizes when there are multiple columns.

But, I would be okay with merging this and adding those improvements incrementally.

@erral
Copy link
Copy Markdown
Member

erral commented Feb 27, 2026

I would say that for the srcset attribute we need to always show the original image URL with its original width set. We have been seen this also in classic and have just prepared a PR in plone.namedfile.

Our usecase was the following:

The srcset attribute was showing only the URLs of scales that are smaller than the original url. In our example, the user uploaded a 500px image, so the srcset showed the 400px one as the first scale. The sizes attribute was setting a 500px wide space, so the browser was rendering the 400px scale, when the original image would fit perfectly.

@davisagli
Copy link
Copy Markdown
Member

@erral This still includes the original image in the srcset unless it is enormous (width greater than the largest defined scale size, which is 4000 pixels in Plone 6.2)

@pnicolli pnicolli moved this from Todo to In progress in Bucharest Sprint 2026 Mar 10, 2026
Comment thread packages/volto/src/components/manage/Blocks/Teaser/DefaultBody.jsx Outdated
@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community Bot commented Mar 19, 2026

Documentation build overview

📚 volto | 🛠️ Build #32177158 | 📁 Comparing ddb87a8 against latest (17d171e)

  🔍 Preview build  

Show files changed (1 files in total): 📝 1 modified | ➕ 0 added | ➖ 0 deleted
File Status
upgrade-guide/index.html 📝 modified

sneridagh and others added 4 commits March 19, 2026 14:49
* main: (122 commits)
  Release 19.0.0-alpha.27
  Release @plone/slate 19.0.0-alpha.12
  Release @plone/razzle 1.0.0-alpha.1
  We do not release @plone/client from here
  Handle create-user 500 responses where body contains 'message' instead of 'error' (#7946)
  Dropzone filewidget a11y (#7956)
  Update css-minimizer-webpack-plugin to v7 and keep razzleOptions.enableSourceMaps control (#7934)
  Refactor Password Reset: Convert Class-Based Component to Functional Component (#7697)
  fix: Fixed searchable types in Object Browser Widget, adding also sel… (#7942)
  Fix in-page drag-and-drop for the Listing block in Volto 18 and 19 (#7907)
  Improved docs of Plone REST API JavaScript Client (#5576)
  Fix Moderate Comments control panel visibility based on Discussion Support addon installation (#7878)
  fix: Add authorization error handling to control panels (#7807)
  Fix subordering order tab (#7937) (#7939)
  Fix converting value to html in HtmlSlateWidget (#7938)
  razzle.config.js: Fix defaultPlugins missing name property to enable addon SCSS plugin replacement (#7908)
  Update users controlpanel to work with new response format (#7895)
  Avoid storing blocksClipboard in localstorage until it has a value (#7925)
  Remove link to Jobfamilie MEDICE: site is no longer a Volto site (redirects to non-Volto destination) (#7929)
  Exclude `.storybook` from ESLint's default hidden directory ignore list via `.eslintignore` to allow linting of Storybook configuration files (#7898)
  ...
Copy link
Copy Markdown
Collaborator

@stevepiercy stevepiercy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happened to the Upgrade Guide entry from 8fe53d2 ? It's also not on main in https://6.docs.plone.org/volto/upgrade-guide/index.html. Search for "humongous"

Comment thread packages/volto/news/7655.bugfix Outdated
@davisagli
Copy link
Copy Markdown
Member

@stevepiercy Good catch, the upgrade guide was accidentally lost in a bad merge. I re-added it in ddb87a8

@sneridagh sneridagh merged commit dd87903 into main Apr 9, 2026
81 of 83 checks passed
@sneridagh sneridagh deleted the donotaddoriginalimagetothesrcset branch April 9, 2026 06:59
@github-project-automation github-project-automation Bot moved this from In progress to Done in Bucharest Sprint 2026 Apr 9, 2026
@sneridagh
Copy link
Copy Markdown
Member Author

Merged! Thanks to all involved!

davisagli added a commit to Manik-Khajuria-5/volto that referenced this pull request May 4, 2026
…oes not have all the scales present. Fixed and update tests. (plone#7655)

Co-authored-by: Steve Piercy <web@stevepiercy.com>
Co-authored-by: David Glick <david@glicksoftware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants