Problem/Motivation

In https://www.drupal.org/node/3173719 we already switched to native lazy loading for images.
It's now time to also move to that for iframes, which we use in our social_embed using the same functionality https://web.dev/articles/iframe-lazy-loading

This has the added benefit of removing libraries unnecessary now it's native behavior.

Remaining tasks

We currently use Lazy to deal with lazy loading for iframes in our social_lazy_loading.

1. First step, is using the setting from the lazy module, this gives us an easy way to add it to a minor version.

2. Second step, is to disable and deprecate social_lazy_loading and write our own text filter, you can basically see the implementation at Drupal\lazy\Plugin\Filter\LazyFilter

the most important part being

if ($lazy_settings['preferNative']) {
              // Set required attribute `loading="lazy"`.
              $node->setAttribute('loading', 'lazy');
            }

this sets the native loading = lazy attribute to the iframe and we can get rid of a lot of the settings

3. Third step add this Filter to social_embed (as that is the only place where we get iframes) so we don't need to maintain another submodule. Also make sure the new filter is added to the same places.

4. Last step is to remove social_lazy_loading and social_lazy_loading_images and drupal/lazy in a major version

Comments

ronaldtebrake created an issue. See original summary.

ronaldtebrake’s picture

Status: Active » Needs work

Part one - https://github.com/goalgorilla/open_social/pull/3709, we add default configuration in our next minor version.

ronaldtebrake’s picture

Part 1 is released as part of 12.1.0-alpha1

ronaldtebrake’s picture

Status: Needs work » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.