Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds configurable image lazy-loading to the Carousel Kit blocks by introducing a carousel-level toggle with a per-slide opt-out, and applying the behavior on render via a WordPress block render filter.
Changes:
- Added
lazyLoadImagesattribute + inspector toggle to the Carousel block (default: enabled). - Added
disableLazyLoadImagesattribute + inspector toggle to the Slide block (default: disabled). - Added a
render_block_carousel-kit/carousel-slidefilter that usesWP_HTML_Tag_Processorto addloading="lazy"to<img>tags when enabled.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/blocks/carousel/types.ts |
Extends block attribute types to include carousel/slide lazy-load flags. |
src/blocks/carousel/edit.tsx |
Adds the Carousel inspector toggle wiring for lazyLoadImages. |
src/blocks/carousel/block.json |
Persists lazyLoadImages with default true and exposes it via block context. |
src/blocks/carousel/slide/edit.tsx |
Adds Slide inspector toggle for disableLazyLoadImages. |
src/blocks/carousel/slide/block.json |
Persists disableLazyLoadImages and declares the carousel context dependency. |
src/blocks/carousel/__tests__/types.test.ts |
Updates TS type tests to include lazyLoadImages. |
inc/Plugin.php |
Implements server-side HTML mutation to add loading="lazy" based on context + slide attrs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
src/blocks/carousel/tests/types.test.ts:66
- In the “should have all required properties” test,
lazyLoadImagesis now a required attribute but it isn’t included in therequiredKeyslist that the test iterates over. This makes the runtime key-presence assertion incomplete; please addlazyLoadImagesto that list so the test actually verifies the new required attribute is present.
lazyLoadImages: false,
};
// Verify all keys exist
const requiredKeys = [
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add LazyLoadImages toggle to Carousel block with per-slide override option
Type of change
Related issue(s)
Closes #93
What changed
loading="lazy" attribute to images inside carousel slides
Breaking changes
Does this introduce a breaking change? If yes, describe the impact and migration path below.
Testing
Test details:
Prerequisites
Test Cases
Verification
View page source to confirm
Screenshots / recordings
If applicable, add screenshots or short recordings.
Checklist