Skip to content

[Feature]: type-safety for keyboard keys #18

@rikberkelder

Description

@rikberkelder

Summary

It's currently unclear what keys keyTap and keyToggle accept. It's of course relatively straight forward for letter and number keys, but special keys are a lot less clear. a few questions I found myself asking:

  • How does the library assume the arrow keys are named
  • How does the library assume the media keys are named
  • Does the library use standard names for modifier keys (think option on macOS and super/winkey on linux/win)
  • and so on.

It would be very helpful to have the function definitions have clearer, more type-safe definitions on the function input side.

Motivation

I'm integrating this module in a program that lets users automate things on their computer, I'm replacing two other modules, where we used one for windows, and another for mac/linux. this is a cross-platform app. Currently, to make sure all the keys a user can input in the configuration would work with tegojs, I'd have to test every edge case (media keys, modifier keys, numpad keys etc) on every platform to make sure everything works and configurations are portable between platforms.

Proposed Solution

No response

Checklist

  • I've searched for related issues
  • I've read the documentation

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions