-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
Description
Feature description
Currently, images within the Slide block do not include the loading="lazy" attribute. Ideally, this should be handled by the WordPress core Image block; however, the feature is still a work in progress (WIP): WordPress/gutenberg#41475
There are two possible approaches to address this:
- Use the
render_block_{$block_name}filter to programmatically add theloading="lazy"attribute to<img>elements within theSlideblock. - Implement lazy loading via JavaScript, following the approach outlined in the Embla Carousel example: https://www.embla-carousel.com/docs/examples/predefined#lazy-load
Note
The first approach is straightforward and requires minimal effort to implement. In contrast, the second approach would require changes to the existing markup along with a refactor of the current implementation.
Problem it solves
It improves performance by ensuring images are loaded only when the carousel enters the visible viewport.
Describe alternatives you've considered
No response
Additional context
No response
Reactions are currently unavailable