Introducing stimulus-shortcut

No shortcuts.

Hot on the heels of stimulus-hotkeys, I am thrilled to release stimulus-shortcut, “a Stimulus controller for mapping keystrokes to element events”.

Based on the preview version of Stimulus 2.0, stimulus-hotkeys wraps the amazing HotKeys.js library and takes advantage of the new Stimulus Values API to bind the keystrokes people type to the default events of elements on your page.

Let’s look at a simple example, in which the user hits the “p” key and it makes the link click itself.

<a data-controller="shortcut" data-shortcut-key-value="p">Type 'p' to activate me!</a>

It’s a sort of sister-controller to stimulus-hotkeys in that they share dependencies and together, cover both common shortcut key patterns. They can be used happily together in the same project.

That’s about it! You can learn more on the Github project page.


Now read this

Introducing Optimism: realtime remote form validation for Rails

I’m proud to announce the public release of Optimism, a new Ruby on Rails gem that makes it easy to add realtime validation error messages to your applications. When a model validation error prevents an update from succeeding, Optimism... Continue →