Skip to content

Release 0.7.3 - #181

Merged
KristjanESPERANTO merged 11 commits into
masterfrom
develop
Feb 16, 2026
Merged

Release 0.7.3#181
KristjanESPERANTO merged 11 commits into
masterfrom
develop

Conversation

@KristjanESPERANTO

Copy link
Copy Markdown
Collaborator

0.7.3 (2026-02-16)

Features

  • add native keyboard control without external dependencies (7cb581d)

Bug Fixes

  • prevent TypeError when module.data is undefined in shouldShowModuleInSlide (f143d6d)

Documentation

Code Refactoring

  • extract indicator ID calculation logic for better testability (c35f84a)

Tests

  • add tests for module filtering, timeouts, and initialization (8afa52f)
  • add unit tests (2292706)

Chores

  • change runner from ubuntu-latest to ubuntu-slim in automated tests (4cb9865)
  • update devDependencies (8c1aafa)
  • update eslint config (fe0a221)
  • update prepare script to handle simple-git-hooks execution (cafdb02)

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
@KristjanESPERANTO
KristjanESPERANTO merged commit f7ec3db into master Feb 16, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant