Release 0.7.3 - #181
Merged
Merged
Conversation
Add built-in keyboard navigation that works without MMM-KeyBindings, making carousel control more accessible out-of-the-box. Features: - New config option `enableKeyboardControl` (default: false) - Keyboard shortcuts: - Arrow Right/Left: next/previous slide - Arrow Down: pause/resume rotation - Home or 0: jump to home slide - 1-9: jump to slide 1-9 (key "1" = first slide) - Only works in 'global' or 'slides' mode (not 'positional') - Smart bounds checking prevents navigation to non-existent slides - Ignores keypresses in input fields Improvements: - Split keyboard logic into separate methods for better maintainability (getMaxSlideIndex, handleKeyboardEvent, setupNativeKeyboardHandler) - Added null-check in updatePause() to prevent crash when carousel container doesn't exist - Added guards in validKeyPress() for positional mode and uninitialized manualTransition Demo configs: - Added demo.config.global.js for global mode demonstration - Updated demo.config.slides.js to actually use slides mode - Updated demo.config.positional.js (removed KeyBindings, added note) - Added npm scripts: demo:global, demo:slides, demo:positional Documentation: - Updated README with enableKeyboardControl option and keyboard shortcuts - Clarified that native keyboard control only works in global/slides modes - Updated "Additional features" section to highlight native keyboard control Technical notes: - Uses capture phase (addEventListener with true) for reliable event handling - Only preventDefault() (no stopPropagation()) to avoid blocking other modules - Handler stored as instance variable to allow future cleanup if needed - No dependency on MMM-KeyBindings for basic keyboard navigation
…uleInSlide Add optional chaining (?.) when accessing module.data.config.carouselId to prevent TypeError crashes when modules don't have a data property. Previously, the code would throw "Cannot read properties of undefined (reading 'config')" when checking carouselId on modules without data. Now it safely returns undefined and the module matches by name anyway.
Extract calculateIndicatorIds() from updateSlideIndicators() to separate business logic from DOM manipulation. This pure function calculates all element IDs for slide indicators and navigation controls based on current index and boundaries. Benefits: - calculateIndicatorIds() is now fully testable without DOM mocking - updateSlideIndicators() is simpler and focused on DOM updates only - Edge cases (first/last/single slide) are covered by unit tests
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.
0.7.3 (2026-02-16)
Features
Bug Fixes
Documentation
Code Refactoring
Tests
Chores