Bug 240083 - Use correct document as root for lazy image observer
Summary: Use correct document as root for lazy image observer
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Images (show other bugs)
Version: Safari 15
Hardware: Unspecified Unspecified
: P2 Critical
Assignee: Rob Buis
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-05-04 15:00 PDT by dukejoon
Modified: 2022-05-06 17:09 PDT (History)
13 users (show)

See Also:


Attachments
Patch (1.73 KB, patch)
2022-05-05 11:54 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (5.63 KB, patch)
2022-05-06 08:38 PDT, Rob Buis
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description dukejoon 2022-05-04 15:00:15 PDT
Hi,

In Safari 15.4 we've noticed an error with the attribute loading="lazy". HTML img tag with this attribute are not loading consistently. If you check the network tab you will see that the images are not being requested at all. So far, the solution is to remove the attribute or use loading="eager".

You can successfully replicate it with this codesanbox (https://codepen.io/intellix/pen/JjMwWae). Found it here (https://github.com/Fyrd/caniuse/issues/6243).

Additionally if you go to "Develop > Experimental Features" and disable "Lazy image loading" the images with loading="lazy" will load consistently.
Comment 1 Rob Buis 2022-05-05 08:21:44 PDT
The html seems to work fine in a standalone file, but as soon as it is embedded in an iframe no image load is triggered.
Comment 2 Radar WebKit Bug Importer 2022-05-05 09:01:16 PDT
<rdar://problem/92798878>
Comment 3 Rob Buis 2022-05-05 11:54:33 PDT
Created attachment 458903 [details]
Patch
Comment 4 Simon Fraser (smfr) 2022-05-05 13:22:35 PDT
Comment on attachment 458903 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=458903&action=review

> Source/WebCore/ChangeLog:8
> +        Use document as root for lazy image observer.

The iframe's document?
Comment 5 Simon Fraser (smfr) 2022-05-05 13:23:04 PDT
Can you test lazy image loading with Command-+ zoom too? I believe we might have some intersection observer bugs with zooming.
Comment 6 Rob Buis 2022-05-06 08:38:22 PDT
Created attachment 458952 [details]
Patch
Comment 7 EWS Watchlist 2022-05-06 08:39:49 PDT
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see https://trac.webkit.org/wiki/WPTExportProcess
Comment 8 EWS 2022-05-06 17:09:29 PDT
Committed r293933 (250379@main): <https://commits.webkit.org/250379@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 458952 [details].