Added comprehensive debugging to the slider module to diagnose navigation issues. The slider was not changing pages when clicking arrows or pagination dots.
Location: renderPreview() method, after page grouping logic
Logs:
sliderId: Unique identifier for the slidertotalModules: Total number of modules in the sliderpageBreakCount: Number of pagebreak modules foundpagesCount: Number of pages createdmodulesPerPage: Array showing how many modules are on each pagemoduleTypes: Types of all modules in order
Purpose: Verify that pages are being grouped correctly from the module array.
Location: Start of initSwiper function
Logs when Swiper initialization begins for a specific slider ID.
Location: After querying for pagination and navigation elements
Logs:
- Whether pagination element was found
- Whether next arrow element was found
- Whether previous arrow element was found
- Number of slides found in DOM
Purpose: Verify that all required DOM elements exist before initializing Swiper.
Location: After calling mapConfigToSwiper()
Logs:
- Swiper modules being used (Navigation, Pagination, etc.)
slidesPerViewsettingloopsettingautoHeightsetting- Navigation enabled/disabled
- Pagination enabled/disabled
- Effect type (slide, fade, etc.)
- Direction (horizontal, vertical)
Purpose: Verify the configuration being passed to Swiper is correct.
Location: After Swiper initialization
Logs:
activeIndex: Current active slide indexslidesLength: Total number of slidesrealIndex: Real index (for loop mode)isBeginning: Whether at first slideisEnd: Whether at last slide- Loop parameter value
- SlidesPerView parameter value
Purpose: Verify Swiper initialized correctly with proper state.
Location: In slideChange event handler
Logs every time a slide changes:
- Current active index
- Real index (for loop mode)
- Previous index
Purpose: Confirm that Swiper is detecting and responding to navigation attempts.
Location: Added event listeners to next/prev/pagination elements
Logs when:
- Next button is clicked (with current index and isEnd state)
- Previous button is clicked (with current index and isBeginning state)
- Pagination is clicked (with target element and current index)
Purpose: Verify that click events are being received by navigation elements.
Location: In the ref directive callback
Logs:
- When ref callback is called
- Whether element has Swiper instance attached
- Whether element has initialization attribute
- When initialization is scheduled
- Warning if init function not found
Purpose: Track when and how often the ref callback executes and whether initialization happens.
Issue: Swiper's loop mode requires at least 3 slides to work properly. With only 2 slides, navigation can break.
Fix: Automatically disable loop when there are fewer than 3 pages:
loop: (sliderModule.loop ?? true) && pageCount >= 3Location: mapConfigToSwiper() method, line ~1426
- Open browser DevTools (F12)
- Go to Console tab
- Filter by
[Slider Debug]to see only slider-related logs - Reload the card to see initialization sequence
- Click navigation arrows/dots to see interaction logs
On successful initialization:
[Slider Debug] Page structure: {...}
[Slider Debug] Ref callback called: {...}
[Slider Debug] Scheduling init for: slider-xxx
[Slider Debug] Starting initialization for: slider-xxx
[Slider Debug] DOM elements found: {...}
[Slider Debug] Swiper options: {...}
[Slider Debug] Swiper initialized successfully: {...}
On navigation click:
[Slider Debug] Next button clicked: {...}
[Slider Debug] Slide changed: {...}
- Pages not grouping correctly: Check page structure log
- Missing DOM elements: Check DOM elements found log
- Wrong configuration: Check Swiper options log
- Navigation not working: Check if click events are logged
- Slide not changing: Check if slideChange event fires
- Loop issues: Check if loop is enabled with < 3 slides
After reviewing debug logs, you can:
- Identify which step is failing
- Check if Swiper is initializing at all
- Verify configuration is correct
- Confirm navigation elements exist
- Test if events are being fired
Once the issue is fixed, search for [Slider Debug] and remove or comment out the console.log statements.
Added in: v2.1.0-beta8