Skip to content

Enhancement: configurable keyboard shortcuts #8

@dpecos

Description

@dpecos

Description

Keyboard shortcuts are hardcoded in src/mdeck/controllers/inputs/keyboard.ts. There is no way to remap keys, add new bindings, or remove default ones without forking the library.

Proposed API

Accept an optional keyboardShortcuts map in createSlideshow() options, where keys are action names and values are key strings or arrays of key strings:

mdeck.createSlideshow({
  keyboardShortcuts: {
    gotoNextSlide: ['ArrowRight', 'ArrowDown', 'j', ' '],
    gotoPreviousSlide: ['ArrowLeft', 'ArrowUp', 'k'],
    togglePresenterMode: 'p',
    toggleFullscreen: 'f',
  }
});

Setting a shortcut to null or omitting it could disable that binding entirely.

Use cases

  • Presentations controlled by a physical clicker with non-standard key codes
  • Accessibility: remapping to keys reachable with one hand
  • Avoiding conflicts with custom JavaScript on the page
  • Adding Shift+Space as a "previous slide" shortcut (commonly requested by reveal.js users)

Ported from gnab/remark#684 and gnab/remark#687

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions