Skip to content

Remove lazy loading from thumbnail#3845

Merged
tvdeyen merged 2 commits intomainfrom
remove-lazy-loading-from-thumbnail
Apr 22, 2026
Merged

Remove lazy loading from thumbnail#3845
tvdeyen merged 2 commits intomainfrom
remove-lazy-loading-from-thumbnail

Conversation

@tvdeyen
Copy link
Copy Markdown
Member

@tvdeyen tvdeyen commented Apr 22, 2026

What is this pull request for?

Setting image.loading = "lazy" after image.src starts the fetch was a
no-op. The loading attribute is consulted before fetch begins, and for
detached Image instances the fetch starts immediately when src is set.
The attribute never actually deferred anything here. Removing it makes
the code honest about what happens and prevents accidental activation
if the order is ever reversed in a context where lazy would be harmful,
such as the crop dialog.

And scope the thumbnail image CSS to direct children

The [loading] opacity rule used a descendant selector which also matched
the cloned img that CropperJS moves into its own canvas inside the
thumbnail. If the clone's load event fired before the original's, the
cropper UI was built while the loading attribute was still set, leaving
the image inside the cropper invisible until the original fired its own
load event. Scoping the rule to direct children keeps the hide/reveal
behavior for our own placeholder while leaving nested imgs untouched.

Checklist

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have added tests to cover this change

tvdeyen added 2 commits April 22, 2026 14:30
The [loading] opacity rule used a descendant selector which also matched
the cloned img that CropperJS moves into its own canvas inside the
thumbnail. If the clone's load event fired before the original's, the
cropper UI was built while the loading attribute was still set, leaving
the image inside the cropper invisible until the original fired its own
load event. Scoping the rule to direct children keeps the hide/reveal
behavior for our own placeholder while leaving nested imgs untouched.
Setting image.loading = "lazy" after image.src starts the fetch was a
no-op. The loading attribute is consulted before fetch begins, and for
detached Image instances the fetch starts immediately when src is set.
The attribute never actually deferred anything here. Removing it makes
the code honest about what happens and prevents accidental activation
if the order is ever reversed in a context where lazy would be harmful,
such as the crop dialog.
@tvdeyen tvdeyen requested a review from a team as a code owner April 22, 2026 12:41
@tvdeyen tvdeyen added backport-to-8.1-stable Needs to be backported to 8.1-stable backport-to-8.2-stable Needs to be backported to 8.2-stable bug labels Apr 22, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.06%. Comparing base (96cdfd4) to head (c8054ff).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3845   +/-   ##
=======================================
  Coverage   98.06%   98.06%           
=======================================
  Files         322      322           
  Lines        8530     8530           
=======================================
  Hits         8365     8365           
  Misses        165      165           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tvdeyen tvdeyen enabled auto-merge April 22, 2026 12:52
@tvdeyen tvdeyen merged commit 41bb7c3 into main Apr 22, 2026
31 checks passed
@tvdeyen tvdeyen deleted the remove-lazy-loading-from-thumbnail branch April 22, 2026 12:57
@alchemycms-bot
Copy link
Copy Markdown

💔 Some backports could not be created

Status Branch Result
8.1-stable Backport failed because of merge conflicts

You might need to backport the following PRs to 8.1-stable:
- fix(alchemy-notice): Use default font size for headings
8.2-stable

Manual backport

To create the backport manually run:

backport --pr 3845

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

@alchemycms-ci-bot
Copy link
Copy Markdown
Collaborator

💚 All backports created successfully

Status Branch Result
8.1-stable

Questions ?

Please refer to the Backport tool documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-to-8.1-stable Needs to be backported to 8.1-stable backport-to-8.2-stable Needs to be backported to 8.2-stable bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants