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
Comment #2
ronaldtebrake commentedPart one - https://github.com/goalgorilla/open_social/pull/3709, we add default configuration in our next minor version.
Comment #3
ronaldtebrake commentedPart 1 is released as part of 12.1.0-alpha1
Comment #4
ronaldtebrake commented